Add Lua function to calculate the number of seconds between dates and use it in assets (#3332)

This commit is contained in:
Alexander Bock
2024-07-11 10:34:06 +02:00
committed by GitHub
parent e7b6cbb4d6
commit b8e9193bc7
71 changed files with 157 additions and 110 deletions

View File

@@ -25,8 +25,8 @@ local Volume = {
MinValue = 0,
MaxValue = 1,
GridType = "Cartesian",
SecondsBefore = 50 * 365 * 24 * 60 * 60, -- 50 years before
SecondsAfter = 50 * 365 * 24 * 60 * 60 -- 50 years after
SecondsBefore = 50 * openspace.time.secondsPerYear(), -- 50 years before
SecondsAfter = 50 * openspace.time.secondsPerYear() -- 50 years after
},
GUI = {
Path = "/Examples"

View File

@@ -19,8 +19,8 @@ local Volume = {
MinValue = 0,
MaxValue = 1,
GridType = "Cartesian",
SecondsBefore = 50 * 365 * 24 * 60 * 60, -- 50 years before
SecondsAfter = 50 * 365 * 24 * 60 * 60 -- 50 years after
SecondsBefore = 50 * openspace.time.secondsPerYear(), -- 50 years before
SecondsAfter = 50 * openspace.time.secondsPerYear() -- 50 years after
},
GUI = {
Path = "/Examples"

View File

@@ -25,8 +25,8 @@ local Volume = {
MinValue = 0,
MaxValue = 1,
GridType = "Spherical",
SecondsBefore = 50 * 365 * 24 * 60 * 60, -- 50 years before
SecondsAfter = 50 * 365 * 24 * 60 * 60 -- 50 years after
SecondsBefore = 50 * openspace.time.secondsPerYear(), -- 50 years before
SecondsAfter = 50 * openspace.time.secondsPerYear() -- 50 years after
},
GUI = {
Path = "/Examples"

View File

@@ -39,8 +39,8 @@ local DensityVolume = {
TransferFunction = asset.resource("transferfunctions/mas-mhd-r-squared.txt"),
SourceDirectory = densityDirectory,
GridType = "Spherical",
SecondsBefore = 24 * 60 * 60,
SecondsAfter = 24 * 60 * 60,
SecondsBefore = openspace.time.secondsPerDay(),
SecondsAfter = openspace.time.secondsPerDay(),
Dimensions = { 100, 100, 128 },
InvertDataAtZ = true
},

View File

@@ -27,7 +27,7 @@ local C2019Q4BorisovTrail = {
Color = { 0.9, 0.9, 0.0 },
StartTime = "2015 JAN 01 00:00:00",
EndTime = "2050 JAN 01 00:00:00",
SampleInterval = 60 * 60 * 24 -- = 86 400 seconds in 1 day
SampleInterval = openspace.time.secondsPerDay()
},
GUI = {
Name = "C/2019 Q4 Borisov Trail",

View File

@@ -27,8 +27,7 @@ local OumuamuaTrail = {
Color = { 0.9, 0.9, 0.0 },
StartTime = "2014 JAN 01 00:00:00",
EndTime = "2050 JAN 01 00:00:00",
SampleInterval = 86400,
TimeStampSubsampleFactor = 1
SampleInterval = openspace.time.secondsPerDay()
},
GUI = {
Name = "'Oumuamua Trail",

View File

@@ -42,8 +42,8 @@ local Magnetosphere = {
StepSize = 0.003,
Dimensions = { 64, 64, 64 },
GridType = "Cartesian",
SecondsBefore = 24 * 60 * 60 * 365 * 100,
SecondsAfter = 24 * 60 * 60 * 365 * 100
SecondsBefore = 100 * openspace.time.secondsPerYear(),
SecondsAfter = 100 * openspace.time.secondsPerYear()
},
GUI = {
Name = "Mercury Magnetosphere",

View File

@@ -32,6 +32,9 @@ local Pioneer10 = {
}
}
local StartTime = "1972 MAR 03 02:04:00"
local EndTime = "1990 JAN 02 00:00:00"
local Pioneer10Trail = {
Identifier = "Pioneer_10Trail",
Parent = sunTransforms.SolarSystemBarycenter.Identifier,
@@ -43,11 +46,12 @@ local Pioneer10Trail = {
Observer = coreKernels.ID.SolarSystemBarycenter
},
Color = { 0.70, 0.50, 0.20 },
StartTime = "1972 MAR 03 02:04:00",
EndTime = "1990 JAN 02 00:00:00",
StartTime = StartTime,
EndTime = EndTime,
EnableFade = false,
SampleInterval = 6545 * 2
-- 6545 is the number of days between the Start and End time (aka sample every 2d)
-- 1 sample every 2d
SampleInterval =
openspace.time.duration(StartTime, EndTime) / openspace.time.secondsPerYear() * 2
},
GUI = {
Name = "Pioneer 10 Trail (SPICE)",

View File

@@ -37,6 +37,9 @@ local Pioneer11 = {
}
}
local StartTime = "1973 APR 06 02:25:00.000"
local EndTime = "1990 JAN 02 00:00:00.000"
local Pioneer11Trail = {
Identifier = "Pioneer_11Trail",
Parent = sunTransforms.SolarSystemBarycenter.Identifier,
@@ -48,11 +51,12 @@ local Pioneer11Trail = {
Observer = coreKernels.ID.SolarSystemBarycenter
},
Color = { 0.70, 0.50, 0.20 },
StartTime = "1973 APR 06 02:25:00.000",
EndTime = "1990 JAN 02 00:00:00.000",
StartTime = StartTime,
EndTime = EndTime,
EnableFade = false,
-- 6087 is the number of days between the Start and End time (so sample every 2d)
SampleInterval = 6087 * 2
-- 1 sample every 2d
SampleInterval =
openspace.time.duration(StartTime, EndTime) / openspace.time.secondsPerYear() * 2
},
GUI = {
Name = "Pioneer 11 Trail (SPICE)",

View File

@@ -95,8 +95,9 @@ local VoyagerTrailCruiseEarthJupiter = {
Color = { 0.70, 0.50, 0.20 },
StartTime = "1977 SEP 05",
EndTime = "1979 MAR 04",
-- 545 is the number of days between the Start and End time
SampleInterval = 545 * 2
-- 1 sample every 2d
SampleInterval = openspace.time.duration("1977 SEP 05", "1979 MAR 04") /
openspace.time.secondsPerYear() * 2
},
Tag = { "voyager1_trail" },
GUI = {
@@ -145,8 +146,9 @@ local VoyagerTrailCruiseJupiterSaturn = {
Color = { 0.70, 0.50, 0.20 },
StartTime = "1979 MAR 09",
EndTime = "1980 NOV 11",
-- 618 is the number of days between the Start and End time
SampleInterval = 618 * 2
-- 1 sample every 2d
SampleInterval = openspace.time.duration("1979 MAR 09", "1980 NOV 11") /
openspace.time.secondsPerYear() * 2
},
Tag = { "voyager1_trail" },
GUI = {
@@ -195,8 +197,10 @@ local VoyagerTrailCruiseSaturnInf = {
Color = { 0.70, 0.50, 0.20 },
StartTime = "1980 NOV 16",
EndTime = "2100 JAN 01",
-- 43511 is the number of days between the Start and End time
SampleInterval = 43511 * 2
-- 1 sample every 2d
SampleInterval = openspace.time.duration("1980 NOV 16", "2100 JAN 01") /
openspace.time.secondsPerYear() * 2
},
Tag = { "voyager1_trail" },
GUI = {

View File

@@ -98,8 +98,9 @@ local VoyagerTrailCruiseEarthJupiter = {
Color = { 0.70, 0.50, 0.20 },
StartTime = "1977-AUG-20 16:07:06.535",
EndTime = "1979 JUL 06",
-- 669 is the number of days between the Start and End time
SampleInterval = 669 * 2
-- 1 sample every 2d
SampleInterval = openspace.time.duration("1977-AUG-20 16:07:06.535", "1979 JUL 06") /
openspace.time.secondsPerYear() * 2
},
Tag = { "voyager2_trail" },
GUI = {
@@ -148,8 +149,9 @@ local VoyagerTrailCruiseJupiterSaturn = {
Color = { 0.70, 0.50, 0.20 },
StartTime = "1979 JUL 15",
EndTime = "1981 AUG 23",
-- 770 is the number of days between the Start and End time
SampleInterval = 770 * 2
-- 1 sample every 2d
SampleInterval = openspace.time.duration("1979 JUL 15", "1981 AUG 23") /
openspace.time.secondsPerYear() * 2
},
Tag = { "voyager2_trail" },
GUI = {
@@ -198,8 +200,9 @@ local VoyagerTrailCruiseSaturnUranus = {
Color = { 0.70, 0.50, 0.20 },
StartTime = "1981 AUG 30",
EndTime = "1986 JAN 22",
-- 1971 is the number of days between the Start and End time
SampleInterval = 1971 * 2
-- 1 sample every 2d
SampleInterval = openspace.time.duration("1981 AUG 30", "1986 JAN 22") /
openspace.time.secondsPerYear() * 2
},
Tag = { "voyager2_trail" },
GUI = {
@@ -248,8 +251,9 @@ local VoyagerTrailCruiseUranusNeptune = {
Color = { 0.70, 0.50, 0.20 },
StartTime = "1986 JAN 27",
EndTime = "1989 AUG 24",
-- 1305 is the number of days between the Start and End time
SampleInterval = 1305 * 2
-- 1 sample every 2d
SampleInterval = openspace.time.duration("1986 JAN 27", "1989 AUG 24") /
openspace.time.secondsPerYear() * 2
},
Tag = { "voyager2_trail" },
GUI = {
@@ -298,8 +302,9 @@ local VoyagerTrailCruiseNeptuneInf = {
Color = { 0.70, 0.50, 0.20 },
StartTime = "1989 AUG 26",
EndTime = "2100 JAN 01",
-- 40306 is the number of days between the Start and End time
SampleInterval = 40306 * 2
-- 1 sample every 2d
SampleInterval = openspace.time.duration("1989 AUG 26", "2100 JAN 01") /
openspace.time.secondsPerYear() * 2
},
Tag = { "voyager2_trail" },
GUI = {

View File

@@ -13,8 +13,6 @@ local pioneer_horizons = asset.resource({
})
local SampleInterval = 24 * 60 * 60
local Voyager1 = {
Identifier = "Voyager1",
Parent = "SolarSystemBarycenter",
@@ -34,8 +32,7 @@ local Voyager1 = {
Fade = 5.0,
StartTime = "1977 SEP 06 00:00:00",
EndTime = "2030 JAN 01 00:00:00",
SampleInterval = SampleInterval,
TimeStampSubsampleFactor = 1
SampleInterval = openspace.time.secondsPerDay()
},
GUI = {
Name = "Voyager 1 Trail",
@@ -64,8 +61,7 @@ local Voyager2 = {
Fade = 5.0,
StartTime = "1977 AUG 21 00:00:00",
EndTime = "2030 JAN 01 00:00:00",
SampleInterval = SampleInterval,
TimeStampSubsampleFactor = 1
SampleInterval = openspace.time.secondsPerDay()
},
GUI = {
Name = "Voyager 2 Trail",
@@ -94,8 +90,7 @@ local Pioneer10 = {
Fade = 5.0,
StartTime = "1972 MAR 04 00:00:00",
EndTime = "2030 JAN 01 00:00:00",
SampleInterval = SampleInterval,
TimeStampSubsampleFactor = 1
SampleInterval = openspace.time.secondsPerDay()
},
GUI = {
Name = "Pioneer 10 Trail",
@@ -124,8 +119,7 @@ local Pioneer11 ={
Fade = 5.0,
StartTime = "1973 APR 07 00:00:00",
EndTime = "2030 JAN 01 00:00:00",
SampleInterval = SampleInterval,
TimeStampSubsampleFactor = 1
SampleInterval = openspace.time.secondsPerDay()
},
GUI = {
Name = "Pioneer 11 Trail",

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_amateur_radio",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=amateur&FORMAT=kvn",
Filename = "amateur.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_x-comm",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=x-comm&FORMAT=kvn",
Filename = "x-comm.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_geo",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=geo&FORMAT=kvn",
Filename = "geo.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_globalstar",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=globalstar&FORMAT=kvn",
Filename = "globalstar.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_gorizont",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=gorizont&FORMAT=kvn",
Filename = "gorizont.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_intelsat",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=intelsat&FORMAT=kvn",
Filename = "intelsat.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_iridium",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=iridium&FORMAT=kvn",
Filename = "iridium.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_iridium-NEXT",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=iridium-NEXT&FORMAT=kvn",
Filename = "iridium-NEXT.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_molniya",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=molniya&FORMAT=kvn",
Filename = "molniya.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_orbcomm",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=orbcomm&FORMAT=kvn",
Filename = "orbcomm.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_other-comm",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=other-comm&FORMAT=kvn",
Filename = "other-comm.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_raduga",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=raduga&FORMAT=kvn",
Filename = "raduga.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_ses",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=ses&FORMAT=kvn",
Filename = "ses.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_starlink",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=starlink&FORMAT=kvn",
Filename = "starlink.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_2019-006",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?INTDES=2019-006&FORMAT=kvn",
Filename = "2019-006.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_2012-044",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?INTDES=2012-044&FORMAT=kvn",
Filename = "2012-044.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_1999-025",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?INTDES=1999-025&FORMAT=kvn",
Filename = "1999-025.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_iridium-33-debris",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=iridium-33-debris&FORMAT=kvn",
Filename = "iridium-33-debris.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_cosmos-2251-debris",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=cosmos-2251-debris&FORMAT=kvn",
Filename = "cosmos-2251-debris.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -24,8 +24,8 @@ local DebrisVolumeCartesian = {
MinValue = 0,
MaxValue = 1,
GridType = "Cartesian",
SecondsBefore = 50 * 365 * 24 * 60 * 60,
SecondsAfter = 50 * 365 * 24 * 60 * 60
SecondsBefore = 50 * openspace.time.secondsPerYear(),
SecondsAfter = 50 * openspace.time.secondsPerYear()
},
GUI = {
Name = "Debris Volume - Cartesian",

View File

@@ -24,8 +24,8 @@ local DebrisVolumeSpherical = {
MinValue = 0,
MaxValue = 1,
GridType = "Spherical",
SecondsBefore = 50 * 365 * 24 * 60 * 60,
SecondsAfter = 50 * 365 * 24 * 60 * 60
SecondsBefore = 50 * openspace.time.secondsPerYear(),
SecondsAfter = 50 * openspace.time.secondsPerYear()
},
GUI = {
Name = "DebrisVolume - Spherical",

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_active",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=active&FORMAT=kvn",
Filename = "active.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_visual",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=visual&FORMAT=kvn",
Filename = "visual.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_cubesat",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=cubesat&FORMAT=kvn",
Filename = "cubesat.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -9,7 +9,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_hst",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?CATNR=20580&FORMAT=kvn",
Filename = "hst.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -24,7 +24,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_iss",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?CATNR=25544&FORMAT=kvn",
Filename = "ISS.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})
local tle = asset.resource({
@@ -33,7 +33,7 @@ local tle = asset.resource({
Identifier = "satellite_tle_data_iss",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?CATNR=25544&FORMAT=tle",
Filename = "ISS.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_military",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=military&FORMAT=kvn",
Filename = "military.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_other",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=other&FORMAT=kvn",
Filename = "other.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_radar",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=radar&FORMAT=kvn",
Filename = "radar.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_stations",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=stations&FORMAT=kvn",
Filename = "stations.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -16,7 +16,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_tiangong",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?CATNR=48274&FORMAT=kvn",
Filename = "Tiangong.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_tle-new",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=last-30-days&FORMAT=kvn",
Filename = "tle-new.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_beidou",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=beidou&FORMAT=kvn",
Filename = "beidou.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_galileo",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=galileo&FORMAT=kvn",
Filename = "galileo.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_glo-ops",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=glo-ops&FORMAT=kvn",
Filename = "glo-ops.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_gps-ops",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=gps-ops&FORMAT=kvn",
Filename = "gps-ops.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_musson",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=musson&FORMAT=kvn",
Filename = "musson.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_nnss",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=nnss&FORMAT=kvn",
Filename = "nnss.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_sbas",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=sbas&FORMAT=kvn",
Filename = "sbas.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_education",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=education&FORMAT=kvn",
Filename = "education.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_engineering",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=engineering&FORMAT=kvn",
Filename = "engineering.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_geodetic",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=geodetic&FORMAT=kvn",
Filename = "geodetic.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_science",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=science&FORMAT=kvn",
Filename = "science.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -9,7 +9,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_aqua",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?CATNR=27424&FORMAT=kvn",
Filename = "Aqua.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_argos",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=argos&FORMAT=kvn",
Filename = "argos.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_dmc",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=dmc&FORMAT=kvn",
Filename = "dmc.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_resource",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=resource&FORMAT=kvn",
Filename = "resource.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_goes",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=goes&FORMAT=kvn",
Filename = "goes.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_noaa",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=noaa&FORMAT=kvn",
Filename = "noaa.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_planet",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=planet&FORMAT=kvn",
Filename = "planet.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_sarsat",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=sarsat&FORMAT=kvn",
Filename = "sarsat.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -9,7 +9,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_snpp",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?CATNR=37849&FORMAT=kvn",
Filename = "SNPP.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_spire",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=spire&FORMAT=kvn",
Filename = "spire.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_tdrss",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=tdrss&FORMAT=kvn",
Filename = "tdrss.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -9,7 +9,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_terra",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?CATNR=25994&FORMAT=kvn",
Filename = "Terra.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -8,7 +8,7 @@ local omm = asset.resource({
Identifier = "satellite_omm_data_weather",
Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=weather&FORMAT=kvn",
Filename = "weather.txt",
SecondsUntilResync = 24 * 60 * 60
SecondsUntilResync = openspace.time.secondsPerDay()
})

View File

@@ -10,6 +10,9 @@ local orbit = asset.resource({
}) .. "c2019y4atlas.hrz"
local StartTime = "1950 JAN 1 00:00:00"
local EndTime = "2100 JAN 1 00:00:00"
local C2019Y4AtlasTrail = {
Identifier = "C2019Y4AtlasTrail",
Parent = sunTransforms.SolarSystemBarycenter.Identifier,
@@ -26,10 +29,9 @@ local C2019Y4AtlasTrail = {
},
Color = { 0.533333, 0.850980, 0.996078 },
EnableFade = false,
StartTime = "1950 JAN 1 0:00:00",
EndTime = "2100 JAN 1 00:00:00",
SampleInterval = 52595, -- About 14h 36m 35.5200s in seconds
TimeStampSubsampleFactor = 1
StartTime = StartTime,
EndTime = EndTime,
SampleInterval = openspace.time.duration(StartTime, EndTime) / 90000
},
GUI = {
Name = "C2019 Y4 Atlas Trail",

View File

@@ -223,6 +223,9 @@ scripting::LuaLibrary Time::luaLibrary() {
codegen::lua::CurrentApplicationTime,
codegen::lua::AdvancedTime,
codegen::lua::ConvertTime,
codegen::lua::Duration,
codegen::lua::SecondsPerDay,
codegen::lua::SecondsPerYear
}
};
}

View File

@@ -22,6 +22,8 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <openspace/util/timeconversion.h>
namespace {
/**
@@ -374,6 +376,36 @@ namespace {
}
}
/**
* Returns the number of seconds between the provided start time and end time. If the end
* time is before the start time, the return value is negative. If the start time is equal
* to the end time, the return value is 0.
* Both start and end times must be valid ISO 8601 date strings.
*/
[[codegen::luawrap]] double duration(std::string start, std::string end) {
using namespace openspace;
const double tStart = Time::convertTime(start);
const double tEnd = Time::convertTime(end);
return tEnd - tStart;
}
/**
* Returns the number of seconds per day where a day in this case is exactly 24 hours.
* The total number of seconds is equal to 86400.
*/
[[codegen::luawrap]] int secondsPerDay() {
return openspace::SecondsPerDay;
}
/**
* Returns the number of seconds in a Julian year, which is equal to 31557600.
*/
[[codegen::luawrap]] int secondsPerYear() {
// We could use a call to SPICE here, but the value is a constant anyway
return openspace::SecondsPerYear;
}
#include "time_lua_codegen.cpp"
} // namespace