From aad10ec154dfa42a1806676cee3f3eed2afbbe80 Mon Sep 17 00:00:00 2001 From: ElonOlsson Date: Tue, 10 Dec 2024 18:05:40 -0500 Subject: [PATCH] Added support for coordinate systems: old GSM as Static, real GSM, SM, GSE and time dependent GSM and SM (#3392) * added old GSM as Static, real GSM, SM, GSE and time dependent GSM and SM * small formating * i dont rember changing this, so taking it back * added support for time dependent GSM and SM to work to year 2099 * added newer kernel * added HEEQ and HEE * better naming and descriptions * rename lowercase * naming rewrite * fix after name change * added earth centric tf files. sun centric left to do and .bpc files and .bsp files * including kernels with asset.resource now. Left is weather to move or change examples/debugcoordinateaxes * minor naming cleanup * cleanup. remove comment * getting rid of debugcoordinateaxes example asset --- .../assets/examples/debugcoordinateaxes.asset | 133 ------------------ .../sun_earth_2012_fieldlines_batsrus.asset | 8 +- .../solarsystem/planets/earth/kernels/GSM.ti | 33 ----- .../earth/magnetosphere/magnetosphere.asset | 8 +- .../transforms_magnetosphere.asset | 54 ------- .../planets/earth/transforms_gse.asset | 65 +++++++++ .../planets/earth/transforms_gsm_sm.asset | 92 ++++++++++++ .../transforms_gsm_sm_timedependent.asset | 126 +++++++++++++++++ .../planets/earth/transforms_gsm_static.asset | 65 +++++++++ .../scene/solarsystem/sun/kernels/HEEQ180.tf | 41 ------ .../sun/transforms_heliosphere.asset | 115 ++++++++++++--- 11 files changed, 453 insertions(+), 287 deletions(-) delete mode 100644 data/assets/examples/debugcoordinateaxes.asset delete mode 100644 data/assets/scene/solarsystem/planets/earth/kernels/GSM.ti delete mode 100644 data/assets/scene/solarsystem/planets/earth/magnetosphere/transforms_magnetosphere.asset create mode 100644 data/assets/scene/solarsystem/planets/earth/transforms_gse.asset create mode 100644 data/assets/scene/solarsystem/planets/earth/transforms_gsm_sm.asset create mode 100644 data/assets/scene/solarsystem/planets/earth/transforms_gsm_sm_timedependent.asset create mode 100644 data/assets/scene/solarsystem/planets/earth/transforms_gsm_static.asset delete mode 100644 data/assets/scene/solarsystem/sun/kernels/HEEQ180.tf diff --git a/data/assets/examples/debugcoordinateaxes.asset b/data/assets/examples/debugcoordinateaxes.asset deleted file mode 100644 index c74c4628d4..0000000000 --- a/data/assets/examples/debugcoordinateaxes.asset +++ /dev/null @@ -1,133 +0,0 @@ -local earthTransforms = asset.require("scene/solarsystem/planets/earth/transforms") -local sunTransforms = asset.require("scene/solarsystem/sun/transforms") - - - -local SunRadius = 6.957E8 -local EarthRadius = 6.371E6 - -local EarthBarycenterAxes = { - Identifier = "EarthBarycenterAxes", - Parent = earthTransforms.EarthBarycenter.Identifier, - Transform = { - Scale = { - Type = "StaticScale", - Scale = EarthRadius * 3.5 - } - }, - Renderable = { - Type = "RenderableCartesianAxes" - }, - GUI = { - Name = "Earth Barycenter Axes", - Path = "/Other/Coordinate Systems" - } -} - -local EarthInertialAxes = { - Identifier = "EarthInertialAxes", - Parent = earthTransforms.EarthInertial.Identifier, - Transform = { - Scale = { - Type = "StaticScale", - Scale = EarthRadius * 2.5 - } - }, - Renderable = { - Type = "RenderableCartesianAxes" - }, - GUI = { - Name = "Earth Inertial Axes", - Path = "/Other/Coordinate Systems" - } -} - -local EarthIAUAxes = { - Identifier = "EarthIAUAxes", - Parent = earthTransforms.EarthIAU.Identifier, - Transform = { - Scale = { - Type = "StaticScale", - Scale = EarthRadius * 1.5 - } - }, - Renderable = { - Type = "RenderableCartesianAxes" - }, - GUI = { - Name = "Earth IAU Axes", - Path = "/Other/Coordinate Systems" - } -} - -local SunIAUAxes = { - Identifier = "SunIAUAxes", - Parent = sunTransforms.SunIAU.Identifier, - Transform = { - Scale = { - Type = "StaticScale", - Scale = SunRadius * 300 - } - }, - Renderable = { - Type = "RenderableCartesianAxes" - }, - GUI = { - Name = "Sun IAU Axes", - Path = "/Other/Coordinate Systems" - } -} - -local SolarSystemBarycenterAxes = { - Identifier = "SolarSystemBarycenterAxes", - Parent = sunTransforms.SolarSystemBarycenter.Identifier, - Transform = { - Scale = { - Type = "StaticScale", - Scale = SunRadius * 300 - } - }, - Renderable = { - Type = "RenderableCartesianAxes" - }, - GUI = { - Name = "Solar System Barycenter Axes", - Path = "/Other/Coordinate Systems" - } -} - - -asset.onInitialize(function() - openspace.addSceneGraphNode(EarthBarycenterAxes) - openspace.addSceneGraphNode(EarthInertialAxes) - openspace.addSceneGraphNode(EarthIAUAxes) - openspace.addSceneGraphNode(SunIAUAxes) - openspace.addSceneGraphNode(SolarSystemBarycenterAxes) - -end) - -asset.onDeinitialize(function() - openspace.removeSceneGraphNode(SolarSystemBarycenterAxes) - openspace.removeSceneGraphNode(SunIAUAxes) - openspace.removeSceneGraphNode(EarthIAUAxes) - openspace.removeSceneGraphNode(EarthInertialAxes) - openspace.removeSceneGraphNode(EarthBarycenterAxes) -end) - -asset.export(EarthBarycenterAxes) -asset.export(EarthInertialAxes) -asset.export(EarthIAUAxes) -asset.export(SunIAUAxes) -asset.export(SolarSystemBarycenterAxes) - - - -asset.meta = { - Name = "Debug Coordinates", - Description = [[A set of coordinate axes demonstrating different XYZ coordinate - reference frames that are useful for debugging, such as the Earth or Solar - System Barycenter.]], - Author = "OpenSpace Team", - URL = "http://openspaceproject.com", - License = "MIT license" -} diff --git a/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_batsrus.asset b/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_batsrus.asset index b11b3d2658..6a34d700e4 100644 --- a/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_batsrus.asset +++ b/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_batsrus.asset @@ -1,5 +1,5 @@ asset.require("scene/solarsystem/heliosphere/2012/reset_loop_action") -local transforms = asset.require("scene/solarsystem/planets/earth/magnetosphere/transforms_magnetosphere") +local transforms = asset.require("scene/solarsystem/planets/earth/transforms_gsm_sm") @@ -59,7 +59,7 @@ local InteractionSphere = 6380000 -- A value slightly bigger than earth radius ----------------------LUTZ's JULY TRACES------------------------- local BatsrusJ12OpenClosed = { Identifier = "FL_BATSRUS_J12_OpenClosed", - Parent = transforms.GSMReferenceFrame.Identifier, + Parent = transforms.GeocentricSolarMagnetospheric.Identifier, InteractionSphere = InteractionSphere, Renderable = { Type = "RenderableFieldlinesSequence", @@ -89,7 +89,7 @@ local BatsrusJ12OpenClosed = { --------------------- VELOCITY FLOWLINES ------------------------ local BatsrusJ12FlowLines = { Identifier = "FL_BATSRUS_J12_FlowLines", - Parent = transforms.GSMReferenceFrame.Identifier, + Parent = transforms.GeocentricSolarMagnetospheric.Identifier, InteractionSphere = InteractionSphere, Renderable = { Type = "RenderableFieldlinesSequence", @@ -116,7 +116,7 @@ local BatsrusJ12FlowLines = { --------------------- Ashers seedpoints ------------------------ local BatsrusAsherStaticSeedsFlowLines = { Identifier = "FL_BATSRUS_ASHER_STATIC_SSEDS_FlowLines", - Parent = transforms.GSMReferenceFrame.Identifier, + Parent = transforms.GeocentricSolarMagnetospheric.Identifier, InteractionSphere = InteractionSphere, Renderable = { Type = "RenderableFieldlinesSequence", diff --git a/data/assets/scene/solarsystem/planets/earth/kernels/GSM.ti b/data/assets/scene/solarsystem/planets/earth/kernels/GSM.ti deleted file mode 100644 index 360c3274f3..0000000000 --- a/data/assets/scene/solarsystem/planets/earth/kernels/GSM.ti +++ /dev/null @@ -1,33 +0,0 @@ -Geocentric Solar Magnetospheric (GSM) frame: -Used by the BATSRUS model -This Kernel's ID is not a valid ID! - - +X is parallel to the geometric earth-sun position vector. - - +Z axis is normalized component of north centered geomagnetic dipole - vector orthogonal to GSM +X axis. - - +Y completes the right-handed frame. - -\begindata - -FRAME_GSM = 13371333 -FRAME_13371333_NAME = 'GSM' -FRAME_13371333_CLASS = 5 -FRAME_13371333_CLASS_ID = 13371333 -FRAME_13371333_CENTER = 399 -FRAME_13371333_RELATIVE = 'GALACTIC' -FRAME_13371333_DEF_STYLE = 'PARAMETERIZED' -FRAME_13371333_FAMILY = 'TWO-VECTOR' -FRAME_13371333_PRI_AXIS = 'X' -FRAME_13371333_PRI_VECTOR_DEF = 'OBSERVER_TARGET_POSITION' -FRAME_13371333_PRI_OBSERVER = 'EARTH' -FRAME_13371333_PRI_TARGET = 'SUN' -FRAME_13371333_PRI_ABCORR = 'NONE' -FRAME_13371333_SEC_AXIS = 'Z' -FRAME_13371333_SEC_VECTOR_DEF = 'CONSTANT' -FRAME_13371333_SEC_FRAME = 'ECLIPJ2000' -FRAME_13371333_SEC_SPEC = 'LATITUDINAL' -FRAME_13371333_SEC_UNITS = 'DEGREES' -FRAME_13371333_SEC_LONGITUDE = 288.43 -FRAME_13371333_SEC_LATITUDE = 79.54 diff --git a/data/assets/scene/solarsystem/planets/earth/magnetosphere/magnetosphere.asset b/data/assets/scene/solarsystem/planets/earth/magnetosphere/magnetosphere.asset index 6bf4588ed2..5190136a15 100644 --- a/data/assets/scene/solarsystem/planets/earth/magnetosphere/magnetosphere.asset +++ b/data/assets/scene/solarsystem/planets/earth/magnetosphere/magnetosphere.asset @@ -1,4 +1,4 @@ -local transforms = asset.require("./transforms_magnetosphere") +local transforms = asset.require("scene/solarsystem/planets/earth/transforms_gsm_static") @@ -11,15 +11,15 @@ local fieldlinesDirectory = asset.resource({ Version = 1 }) - local EarthMagnetosphere = { Identifier = "EarthMagnetosphere", - Parent = transforms.GSMReferenceFrame.Identifier, + Parent = transforms.GeocentricSolarMagnetosphericStatic.Identifier, InteractionSphere = 6380000, -- A value slightly bigger than earth radius Renderable = { Type = "RenderableFieldlinesSequence", SourceFolder = fieldlinesDirectory, LineWidth = 1.0, + ShowAtAllTimes = true, AlphaBlendlingEnabled = false, InputFileType = "Osfls", -- OpenSpace Field lines sequence MaskingEnabled = true, @@ -28,8 +28,8 @@ local EarthMagnetosphere = { ColorMethod = "By Quantity", ColorQuantity = 4, -- speed ColorTableRanges = { { 50, 300 } }, - ColorTablePaths = { transferFunction }, LoadAtRuntime = true, + ColorTablePaths = { transferFunction }, ScaleToMeters = 1.0, Color = { 1.0, 0.725, 0.75, 0.8 } }, diff --git a/data/assets/scene/solarsystem/planets/earth/magnetosphere/transforms_magnetosphere.asset b/data/assets/scene/solarsystem/planets/earth/magnetosphere/transforms_magnetosphere.asset deleted file mode 100644 index b169211d78..0000000000 --- a/data/assets/scene/solarsystem/planets/earth/magnetosphere/transforms_magnetosphere.asset +++ /dev/null @@ -1,54 +0,0 @@ -local transforms = asset.require("scene/solarsystem/planets/earth/transforms") -local coreKernels = asset.require("spice/core") - - - -local GSMKernel = asset.resource("../kernels/GSM.ti") - - -local Frame = { - GSM = "GSM" -- Geocentric Solar Magnetospheric -} - -local GSMReferenceFrame = { - Identifier = "GSMReferenceFrame", - Parent = transforms.EarthCenter.Identifier, - Transform = { - Rotation = { - Type = "SpiceRotation", - SourceFrame = Frame.GSM, - DestinationFrame = coreKernels.Frame.Galactic - } - }, - GUI = { - Name = "GSM Reference Frame", - Path = "/Solar System/Planets/Earth", - Hidden = true - } -} - - -asset.onInitialize(function() - openspace.spice.loadKernel(GSMKernel) - - openspace.addSceneGraphNode(GSMReferenceFrame) -end) - -asset.onDeinitialize(function() - openspace.removeSceneGraphNode(GSMReferenceFrame) - - openspace.spice.unloadKernel(GSMKernel) -end) - -asset.export("Frame", Frame) -asset.export(GSMReferenceFrame) - - - -asset.meta = { - Name = "Earth magnetosphere transforms", - Description = "Earth transforms: GSMReferenceFrame. Geocentric Solar Magnetospheric", - Author = "CCMC", - URL = "http://openspaceproject.com", - License = "MIT license" -} diff --git a/data/assets/scene/solarsystem/planets/earth/transforms_gse.asset b/data/assets/scene/solarsystem/planets/earth/transforms_gse.asset new file mode 100644 index 0000000000..84e5d71b57 --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/transforms_gse.asset @@ -0,0 +1,65 @@ +local transforms = asset.require("scene/solarsystem/planets/earth/transforms") +local coreKernels = asset.require("spice/core") + + + +local earthcentricKernels = asset.resource({ + Name = "Earthcenteric Frame Kernels", + Type = "HttpSynchronization", + Identifier = "earthcentric_frame_kernels", + Version = 1 +}) + +local Frame = { + GSE = "GSE" +} + +local GeocentricSolarEcliptic = { + Identifier = "GeocentricSolarEcliptic", + Parent = transforms.EarthCenter.Identifier, + Transform = { + Rotation = { + Type = "SpiceRotation", + SourceFrame = Frame.GSE, + DestinationFrame = coreKernels.Frame.Galactic + } + }, + GUI = { + Name = "Geocentric Solar Ecliptic", + Path = "/Solar System/Planets/Earth", + Description = [[The X-Y plane is defined by the Earth Mean Ecliptic plane of date: + the +Z axis, primary vector, is the normal vector to this plane, + always pointing toward the North side of the invariant plane. + +X axis is the component of the Earth-Sun vector that is orthogonal + to the +Z axis. + +Y axis completes the right-handed system.]], + Hidden = true + } +} + + +asset.onInitialize(function() + openspace.spice.loadKernel(earthcentricKernels .."ECLIPDATE.tf") + openspace.spice.loadKernel(earthcentricKernels .."GSE.tf") + openspace.addSceneGraphNode(GeocentricSolarEcliptic) +end) + +asset.onDeinitialize(function() + openspace.removeSceneGraphNode(GeocentricSolarEcliptic) + openspace.spice.unloadKernel(earthcentricKernels .."GSE.tf") + openspace.spice.unloadKernel(earthcentricKernels .."ECLIPDATE.tf") +end) + +asset.export("Frame", Frame) +asset.export(GeocentricSolarEcliptic) + + + +asset.meta = { + Name = "Geocentric Solar Ecliptic (GSE) frame Transform", + Version = "1.0", + Description = "Earth transform GSE Reference Frame", + Author = "CCMC", + URL = "http://openspaceproject.com", + License = "MIT license" +} diff --git a/data/assets/scene/solarsystem/planets/earth/transforms_gsm_sm.asset b/data/assets/scene/solarsystem/planets/earth/transforms_gsm_sm.asset new file mode 100644 index 0000000000..6b3bf4d13b --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/transforms_gsm_sm.asset @@ -0,0 +1,92 @@ +local transforms = asset.require("scene/solarsystem/planets/earth/transforms") +local coreKernels = asset.require("spice/core") + + + +local earthcentricKernels = asset.resource({ + Name = "Earthcenteric Frame Kernels", + Type = "HttpSynchronization", + Identifier = "earthcentric_frame_kernels", + Version = 1 +}) + +local Frame = { + GSM = "EARTH_GSM_IGRF2000", -- Geocentric Solar Magnetospheric + SM = "EARTH_SM_IGRF2000", +} + +local GeocentricSolarMagnetospheric = { + Identifier = "GeocentricSolarMagnetospheric", + Parent = transforms.EarthCenter.Identifier, + Transform = { + Rotation = { + Type = "SpiceRotation", + SourceFrame = Frame.GSM, + DestinationFrame = coreKernels.Frame.Galactic + } + }, + GUI = { + Name = "Geocentric Solar Magnetospheric", + Path = "/Solar System/Planets/Earth", + Description = [[ +X is parallel to the geometric earth-sun position vector. + +Z axis is normalized component of north centered geomagnetic dipole + vector orthogonal to GSM +X axis. + +Y completes the right-handed frame. + - the origin of this frame is the center of mass of the Earth.]], + Hidden = true + } +} + +local SolarMagnetic = { + Identifier = "SolarMagnetic", + Parent = transforms.EarthCenter.Identifier, + Transform = { + Rotation = { + Type = "SpiceRotation", + SourceFrame = Frame.SM, + DestinationFrame = coreKernels.Frame.Galactic + } + }, + GUI = { + Name = "Solar Magnetic", + Path = "/Solar System/Planets/Earth", + Description = [[+Z axis is the direction of Earth's magnetic dipole axis + (positive North); it's the primary vector. + +X axis is the projection of the geometric position of the + Sun relative to the Earth onto the plane perpendicular to the + Z axis. + +Y axis completes the right-handed system. + - the origin of this frame is the center of mass of the Earth.]], + Hidden = true + } +} + + +asset.onInitialize(function() + openspace.spice.loadKernel(earthcentricKernels .. "GSM.tf") + openspace.spice.loadKernel(earthcentricKernels .. "SM.tf") + openspace.addSceneGraphNode(GeocentricSolarMagnetospheric) + openspace.addSceneGraphNode(SolarMagnetic) +end) + +asset.onDeinitialize(function() + openspace.removeSceneGraphNode(SolarMagnetic) + openspace.removeSceneGraphNode(GeocentricSolarMagnetospheric) + openspace.spice.unloadKernel(earthcentricKernels .. "SM.tf") + openspace.spice.unloadKernel(earthcentricKernels .. "GSM.tf") +end) + +asset.export("Frame", Frame) +asset.export(GeocentricSolarMagnetospheric) +asset.export(SolarMagnetic) + + + +asset.meta = { + Name = "Earth GSM and SM transforms", + Version = "1.0", + Description = "Earth transform GSM Reference Frame. Geocentric Solar Magnetospheric, SM Reference Frame, Solar Magnetic", + Author = "CCMC", + URL = "http://openspaceproject.com", + License = "MIT license" +} diff --git a/data/assets/scene/solarsystem/planets/earth/transforms_gsm_sm_timedependent.asset b/data/assets/scene/solarsystem/planets/earth/transforms_gsm_sm_timedependent.asset new file mode 100644 index 0000000000..eaf1122589 --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/transforms_gsm_sm_timedependent.asset @@ -0,0 +1,126 @@ +local transforms = asset.require("scene/solarsystem/planets/earth/transforms") +local coreKernels = asset.require("spice/core") + + + +local earthcentricKernels = asset.resource({ + Name = "Earthcenteric Frame Kernels", + Type = "HttpSynchronization", + Identifier = "earthcentric_frame_kernels", + Version = 1 +}) + +local ITRF93Kernels = asset.resource({ + Name = "ITRF93 Kernels", + Type = "HttpSynchronization", + Identifier = "itrf93_kernels", + Version = 1 +}) + +local NorthPoleKernels = asset.resource({ + Name = "North Pole Kernels", + Type = "HttpSynchronization", + Identifier = "northpole_kernels", + Version = 1 +}) + +local Frame = { + GSM_time = "EARTH_GSM_IGRF", + SM_time = "EARTH_SM_IGRF" +} + +local GeocentricSolarMagnetosphericTimeDependent = { + Identifier = "GeocentricSolarMagnetosphericTimeDependent", + Parent = transforms.EarthCenter.Identifier, + Transform = { + Rotation = { + Type = "SpiceRotation", + SourceFrame = Frame.GSM_time, + DestinationFrame = coreKernels.Frame.Galactic + } + }, + GUI = { + Name = "Geocentric Solar Magnetospheric (Timedependent)", + Path = "/Solar System/Planets/Earth", + Description = [[The Earth's magnetic dipole axis direction is time- + variable and is defined by the EARTH_NORTH_POLE/399901 object location + as seen from the Earth center provided in the SPK file + earthnpole_19500101_20251231_v01.bsp (or newer). + +X is parallel to the geometric earth-sun position vector. + +Z axis is normalized component of north centered geomagnetic dipole + vector orthogonal to GSM +X axis. + +Y completes the right-handed frame. + - the origin of this frame is the center of mass of the Earth.]], + Hidden = true + } +} + +--like the other SM reference frame but with a time variant magnetic north pole. Update every 5years : +-- 20251231, 20301231 etc... +local SolarMagneticTimeDependent = { + Identifier = "SolarMagneticTimeDependent", + Parent = transforms.EarthCenter.Identifier, + Transform = { + Rotation ={ + Type = "SpiceRotation", + SourceFrame = Frame.SM_time, + DestinationFrame = coreKernels.Frame.Galactic + } + }, + GUI = { + Name = "Solar Magnetic (Timedependent)", + Path = "/Solar System/Planets/Earth", + Description = [[ The Earth's magnetic dipole axis direction is time- + variable and is defined by the EARTH_NORTH_POLE/399901 object location + as seen from the Earth center provided in the SPK file + earthnpole_19500101_20251231_v01.bsp (or newer). + +Z axis is the direction of Earth's magnetic dipole axis + (positive North); it's the primary vector. + +X axis is the projection of the geometric position of the + Sun relative to the Earth onto the plane perpendicular to the + Z axis. + +Y axis completes the right-handed system. + - the origin of this frame is the center of mass of the Earth.]], + Hidden = true + } +} + + +asset.onInitialize(function() + openspace.spice.loadKernel(NorthPoleKernels .. "earthnpole_19500101_20251231_v01.bsp") + openspace.spice.loadKernel(NorthPoleKernels .. "earthnpole_runout.bsp") + openspace.spice.loadKernel(ITRF93Kernels .. "earth_200101_990825_predict.bpc") + openspace.spice.loadKernel(ITRF93Kernels .. "earth_620120_240827.bpc") + openspace.spice.loadKernel(ITRF93Kernels .. "earth_latest_high_prec.bpc") + openspace.spice.loadKernel(earthcentricKernels .. "GSM_time.tf") + openspace.spice.loadKernel(earthcentricKernels .. "SM_time.tf") + openspace.addSceneGraphNode(GeocentricSolarMagnetosphericTimeDependent) + openspace.addSceneGraphNode(SolarMagneticTimeDependent) +end) + +asset.onDeinitialize(function() + openspace.removeSceneGraphNode(SolarMagneticTimeDependent) + openspace.removeSceneGraphNode(GeocentricSolarMagnetosphericTimeDependent) + openspace.spice.unloadKernel(earthcentricKernels .. "SM_time.tf") + openspace.spice.unloadKernel(earthcentricKernels .. "GSM_time.tf") + openspace.spice.unloadKernel(ITRF93Kernels .. "earth_latest_high_prec.bpc") + openspace.spice.unloadKernel(ITRF93Kernels .. "earth_620120_240827.bpc") + openspace.spice.unloadKernel(ITRF93Kernels .. "earth_200101_990825_predict.bpc") + openspace.spice.unloadKernel(NorthPoleKernels.. "earthnpole_runout.bsp") + openspace.spice.unloadKernel(NorthPoleKernels.. "earthnpole_19500101_20251231_v01.bsp") +end) + +asset.export("Frame", Frame) +asset.export(GeocentricSolarMagnetosphericTimeDependent) +asset.export(SolarMagneticTimeDependent) + + + +asset.meta = { + Name = "Earth's time dependent magnetic northpole GSM and SM transforms", + Version = "1.0", + Description = "Earth transforms: Earth's time dependent magnetic northpole GSM, Geocentric Solar Magnetospheric and SM, Solar Magnetic transforms", + Author = "CCMC", + URL = "http://openspaceproject.com", + License = "MIT license" +} diff --git a/data/assets/scene/solarsystem/planets/earth/transforms_gsm_static.asset b/data/assets/scene/solarsystem/planets/earth/transforms_gsm_static.asset new file mode 100644 index 0000000000..19048f6252 --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/transforms_gsm_static.asset @@ -0,0 +1,65 @@ +local transforms = asset.require("scene/solarsystem/planets/earth/transforms") +local coreKernels = asset.require("spice/core") + + + +local earthcentricKernels = asset.resource({ + Name = "Earthcenteric Frame Kernels", + Type = "HttpSynchronization", + Identifier = "earthcentric_frame_kernels", + Version = 1 +}) + +local Frame = { + GSM_static = "GSM_STATIC" -- Geocentric Solar Magnetospheric +} + +local GeocentricSolarMagnetosphericStatic = { + Identifier = "GeocentricSolarMagnetosphericStatic", + Parent = transforms.EarthCenter.Identifier, + Transform = { + Rotation = { + Type = "SpiceRotation", + SourceFrame = Frame.GSM_static, + DestinationFrame = coreKernels.Frame.Galactic + } + }, + GUI = { + Name = "Geocentric Solar Magnetospheric Static", + Path = "/Solar System/Planets/Earth", + Description =[[The Kernel for this is the same as + GSM (Geocentric Solar Magnetospheric), except it is using + ECLIPJ2000 instead of IAU_EARTH for the secondary axis. GSM is defind as: + +X is parallel to the geometric earth-sun position vector. + +Z axis is normalized component of north centered geomagnetic dipole + vector orthogonal to GSM +X axis. + +Y completes the right-handed frame. + - the origin of this frame is the center of mass of the Earth.]], + Hidden = true + } +} + + +asset.onInitialize(function() + openspace.spice.loadKernel(earthcentricKernels .. "GSM_static.tf") + openspace.addSceneGraphNode(GeocentricSolarMagnetosphericStatic ) +end) + +asset.onDeinitialize(function() + openspace.removeSceneGraphNode(GeocentricSolarMagnetosphericStatic ) + openspace.spice.unloadKernel(earthcentricKernels .. "GSM_static.tf") +end) + +asset.export("Frame", Frame) +asset.export(GeocentricSolarMagnetosphericStatic ) + + + +asset.meta = { + Name = "Earth static GSM transforms", + Version = "1.0", + Description = "A static version of Earth transform GSM Reference Frame. Geocentric Solar Magnetospheric", + Author = "CCMC", + URL = "http://openspaceproject.com", + License = "MIT license" +} diff --git a/data/assets/scene/solarsystem/sun/kernels/HEEQ180.tf b/data/assets/scene/solarsystem/sun/kernels/HEEQ180.tf deleted file mode 100644 index 4106801ce9..0000000000 --- a/data/assets/scene/solarsystem/sun/kernels/HEEQ180.tf +++ /dev/null @@ -1,41 +0,0 @@ -\begintext - -Heliocentric Earth Equatorial (HEEQ+180) Frame -Used by the BATSRUS model -This Kernel's ID is not a valid ID! - Definition of the Heliocentric Earth Equatorial frame: - - All vectors are geometric: no aberration corrections are - used. - - The solar rotation axis is the primary vector: the Z axis points - in the solar north direction. - - The position of the sun relative to the earth is the secondary - vector: the X axis is the component of this position vector - orthogonal to the Z axis. - - The Y axis is Z cross X, completing the right-handed - reference frame. - -\begindata - - FRAME_HEEQ180 = 6666666 - FRAME_6666666_NAME = 'HEEQ180' - FRAME_6666666_CLASS = 5 - FRAME_6666666_CLASS_ID = 6666666 - FRAME_6666666_CENTER = 10 - FRAME_6666666_RELATIVE = 'J2000' - FRAME_6666666_DEF_STYLE = 'PARAMETERIZED' - FRAME_6666666_FAMILY = 'TWO-VECTOR' - FRAME_6666666_PRI_AXIS = 'Z' - FRAME_6666666_PRI_VECTOR_DEF = 'CONSTANT' - FRAME_6666666_PRI_FRAME = 'IAU_SUN' - FRAME_6666666_PRI_SPEC = 'RECTANGULAR' - FRAME_6666666_PRI_VECTOR = ( 0, 0, 1 ) - FRAME_6666666_SEC_AXIS = 'X' - FRAME_6666666_SEC_VECTOR_DEF = 'OBSERVER_TARGET_POSITION' - FRAME_6666666_SEC_OBSERVER = 'EARTH' - FRAME_6666666_SEC_TARGET = 'SUN' - FRAME_6666666_SEC_ABCORR = 'NONE' - FRAME_6666666_SEC_FRAME = 'IAU_SUN' diff --git a/data/assets/scene/solarsystem/sun/transforms_heliosphere.asset b/data/assets/scene/solarsystem/sun/transforms_heliosphere.asset index 56c750dd8c..45e9828964 100644 --- a/data/assets/scene/solarsystem/sun/transforms_heliosphere.asset +++ b/data/assets/scene/solarsystem/sun/transforms_heliosphere.asset @@ -3,15 +3,15 @@ local coreKernels = asset.require("spice/core") -local kernel = asset.resource("kernels/HEEQ180.tf") +local SunCentricFrameKernels = asset.resource({ + Name = "Sun Centric Frame Kernels", + Type = "HttpSynchronization", + Identifier = "suncentric_frame_kernels", + Version = 1 +}) -local HEEQ180ReferenceFrame = { - Identifier = "HEEQ180ReferenceFrame", - -- The HEEQ180 reference frame should have Sun_IAU as parent - -- instead of Solar center, however the Sun_IAU adds - -- an unwanted rotation which is difficult to cancel out - -- since it is using SpiceRotation. Sun center - -- is used instead. +local HeliocentricEarthEquatorial180 = { + Identifier = "HeliocentricEarthEquatorial180", Parent = sunTransforms.SunCenter.Identifier, Transform = { Rotation = { @@ -21,32 +21,111 @@ local HEEQ180ReferenceFrame = { } }, GUI = { - Name = "HEEQ180 Reference Frame", + Name = "Heliocentric Earth Equatorial 180", Path = "/Solar System/Sun", + Description = [[ - X-Y plane is the solar equator of date, therefore, the +Z axis + is the primary vector and it is aligned to the Sun's north pole + of date. + + - +X axis is defined by the intersection between the Sun equatorial + plane and the solar central meridian of date as seen from the Earth. + The solar central meridian of date is defined as the meridian of the + Sun that is turned toward the Earth. Therefore, +X axis is the + component of the Sun-Earth vector that is orthogonal to the +Z axis. + + - +Y axis completes the right-handed system. + + - the origin of this frame is the Sun's center of mass.]], + Hidden = true + } +} + +local HeliocentricEarthEquatorial = { + Identifier = "HeliocentricEarthEquatorial", + Parent = sunTransforms.SunCenter.Identifier, + Transform = { + Rotation = { + Type = "SpiceRotation", + SourceFrame = "HEEQ", + DestinationFrame = coreKernels.Frame.Galactic + } + }, + GUI = { + Name = "Heliocentric Earth Equatorial", + Path = "/Solar System/Sun", + Description = [[ - X-Y plane is the solar equator of date, therefore, the +Z axis + is the primary vector and it is aligned to the Sun's north pole + of date. + + - +X axis is defined by the intersection between the Sun equatorial + plane and the solar central meridian of date as seen from the Earth. + The solar central meridian of date is defined as the meridian of the + Sun that is turned toward the Earth. Therefore, +X axis is the + component of the Sun-Earth vector that is orthogonal to the +Z axis. + + - +Y axis completes the right-handed system. + + - the origin of this frame is the Sun's center of mass.]], + Hidden = true + } +} + +local HeliocentricEarthEcliptic = { + Identifier = "HeliocentricEarthEcliptic", + Parent = sunTransforms.SunCenter.Identifier, + Transform = { + Rotation = { + Type = "SpiceRotation", + SourceFrame = "HEE", + DestinationFrame = coreKernels.Frame.Galactic + } + }, + GUI = { + Name = "Heliocentric Earth Ecliptic", + Path = "/Solar System/Sun", + Description = [[ - X-Y plane is defined by the Earth Mean Ecliptic plane of date, + therefore, the +Z axis is the primary vector,and it defined as + the normal vector to the Ecliptic plane that points toward the + north pole of date \n + + - +X axis is the component of the Sun-Earth vector that is + orthogonal to the +Z axis. + + - +Y axis completes the right-handed system. + + - the origin of this frame is the Sun's center of mass.]], Hidden = true } } asset.onInitialize(function() - openspace.spice.loadKernel(kernel) - - openspace.addSceneGraphNode(HEEQ180ReferenceFrame) + openspace.spice.loadKernel(SunCentricFrameKernels .. "HEEQ180.tf") + openspace.spice.loadKernel(SunCentricFrameKernels .. "HEEQ.tf") + openspace.spice.loadKernel(SunCentricFrameKernels .. "HEE.tf") + openspace.addSceneGraphNode(HeliocentricEarthEquatorial180) + openspace.addSceneGraphNode(HeliocentricEarthEquatorial) + openspace.addSceneGraphNode(HeliocentricEarthEcliptic) end) asset.onDeinitialize(function() - openspace.removeSceneGraphNode(HEEQ180ReferenceFrame) - - openspace.spice.unloadKernel(kernel) + openspace.removeSceneGraphNode(HeliocentricEarthEcliptic) + openspace.removeSceneGraphNode(HeliocentricEarthEquatorial) + openspace.removeSceneGraphNode(HeliocentricEarthEquatorial180) + openspace.spice.unloadKernel(SunCentricFrameKernels .."HEE.tf") + openspace.spice.unloadKernel(SunCentricFrameKernels .."HEEQ.tf") + openspace.spice.unloadKernel(SunCentricFrameKernels .."HEEQ180.tf") end) -asset.export(HEEQ180ReferenceFrame) +asset.export(HeliocentricEarthEquatorial180) +asset.export(HeliocentricEarthEquatorial) +asset.export(HeliocentricEarthEcliptic) asset.meta = { - Name = "Sun Transform, HEEQ180", - Description = "Sun transform: HEEQ180", + Name = "Sun Transform, HEE, HEEQ and HEEQ180", + Description = "Sun transform: HEE, HEEQ and HEEQ180", Author = "CCMC", URL = "http://openspaceproject.com", License = "MIT license"