Cosmic ray physics in space: from fundamental physics to applications