diff --git a/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/Defs.cs b/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/Defs.cs index 806c1c1d..e0670164 100644 --- a/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/Defs.cs +++ b/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/Defs.cs @@ -50,6 +50,7 @@ Date Developer 2025/06/21 GLS 2025/07/16 GLS 2025/11/16 GLS +2026/01/02 GLS ********************************************/ /**************************************************************************** This file is part of Space Shuttle Ultra Workbench @@ -91,6 +92,16 @@ class Defs public const double MPS2FPS = 3.280839895;// meters per seconds to feet per second + public const double LC39A_LAT = 28.6083850;// deg + public const double LC39A_LON = -80.6040720;// deg + + public const double LC39B_LAT = 28.6272150;// deg + public const double LC39B_LON = -80.6208620;// deg + + public const double SLC6_LAT = 34.5808470;// deg + public const double SLC6_LON = -120.6259500;// deg + + public const string strKSC = "KSC"; public const string strVAFB = "VAFB"; diff --git a/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/Mission.cs b/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/Mission.cs index 2cc24c3a..cccf8fc7 100644 --- a/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/Mission.cs +++ b/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/Mission.cs @@ -70,6 +70,7 @@ Date Developer 2025/10/02 GLS 2025/11/16 GLS 2025/11/24 GLS +2025/12/30 GLS ********************************************/ /**************************************************************************** This file is part of Space Shuttle Ultra Workbench @@ -291,10 +292,11 @@ private void LoadDefault() MECO_Inc = 51.62; - //MECO_LAN = 0; MECO_Alt = 105564; MECO_Vel = 7903.449390; MECO_FPA = 0.708380; + EF_PLANE_SW = false; + IYD = "0.0 0.0 0.0"; @@ -341,10 +343,11 @@ private void ResetMission() MECO_Inc = 51.62; - //MECO_LAN = 0; MECO_Alt = 105564; MECO_Vel = 7903.449390; MECO_FPA = 0.708380; + EF_PLANE_SW = false; + IYD = "0.0 0.0 0.0"; T0Year = 2000; @@ -608,10 +611,19 @@ public void Load_V1( JObject jmf ) T0Second = dt.Second + (0.001 * dt.Millisecond); } MECO_Inc = (double)jmf["Legacy Launch Parameters"]["TargetInc"]; - //MECO_LAN = (double)jmf["Legacy Launch Parameters"]["TargetLAN"]; MECO_Alt = (double)jmf["Legacy Launch Parameters"]["MECOAlt"]; MECO_Vel = (double)jmf["Legacy Launch Parameters"]["MECOVel"]; MECO_FPA = (double)jmf["Legacy Launch Parameters"]["MECOFPA"]; + JToken jpsw = jmf["Legacy Launch Parameters"]["EF_PLANE_SW"]; + if (jpsw != null) + { + EF_PLANE_SW = (bool)jpsw; + } + JToken jiyd = jmf["Legacy Launch Parameters"]["IYD"]; + if (jiyd != null) + { + IYD = (string)jiyd; + } //////// Xenon Lights //////// XenonLights.Load_V1( jmf["Xenon Lights"] ); @@ -765,10 +777,11 @@ public JObject Save_V1() DateTime dt = new DateTime( T0Year, T0Month, T0Day, T0Hour, T0Minute, (int)T0Second, ms ); joldlaunchparams["T0"] = dt.ToOADate() + 15018.0; joldlaunchparams["TargetInc"] = MECO_Inc; - //joldlaunchparams["TargetLAN"] = MECO_LAN; joldlaunchparams["MECOAlt"] = MECO_Alt; joldlaunchparams["MECOVel"] = MECO_Vel; joldlaunchparams["MECOFPA"] = MECO_FPA; + joldlaunchparams["EF_PLANE_SW"] = EF_PLANE_SW; + joldlaunchparams["IYD"] = IYD; jroot["Legacy Launch Parameters"] = joldlaunchparams; //////// Xenon Lights //////// @@ -1751,6 +1764,16 @@ public bool Test( ref string str ) /// public double MECO_FPA { get; set; } + /// + /// Earth–fixed plane switch + /// + public bool EF_PLANE_SW { get; set; } + + /// + /// IYD + /// + public string IYD { get; set; } + diff --git a/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/OrbitTgtCalc.cs b/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/OrbitTgtCalc.cs index 4602e9bf..8c8fa276 100644 --- a/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/OrbitTgtCalc.cs +++ b/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/OrbitTgtCalc.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace SSVMissionEditor { @@ -18,6 +18,11 @@ class OrbitTgtCalcOptions public double H_OMS2; //Height above equator of OMS-2 target (can be apogee or perigee after OMS-2 burn), nautical miles public double Inclination; //Inclination, radians public bool InsertionMode; //true = direct, false = standard insertion + public bool CalcIY;// flag to enable EF IY vector calculation + public double Pad_Latitude;// Latitude of launch pad [degrees] + public double Pad_Longitude;// Longitude of launch pad [degrees] + public double Inc_Max;// Maximum inclination allowed before "dog-leg" [degrees] + public double Inc_Min;// Minimum inclination allowed before "dog-leg" [degrees] } class OrbitTgtCalcOutput @@ -27,6 +32,9 @@ class OrbitTgtCalcOutput public double TGTMECOvel; // Velocity for MECO, m/s public double TGTMECOfpa; //Flight path angle for MECO, degrees public double TGTMECOinclination; //Inclination at MECO, degrees + public double TGTMECOIYx;// IY.x + public double TGTMECOIYy;// IY.y + public double TGTMECOIYz;// IY.z //OMS-1 and 2 public OMSTargetSet oms1, oms2; //PEG-4 @@ -532,6 +540,61 @@ double MECOTargetLineDI57(double v_Ins) return (1.59 - 0.88) / (26160 - 25945) * (v_Ins - 25945) + 0.88; } + VECTOR3 CalculateEFIYVector(double Incl, double Lat, double Lng, bool north, double dt_bias) + { + // Calculate insertion orbital plane (IY) in Earth-fixed coordinates, taking into account Earth rotation + // INPUTS: + // Incl = Desired inclination, radians + // Lat = Launch or present latitude, radians + // Lng = Launch or present longitude, radians + // north = launch heading is northerly, true = north, false = south + // dt_bias = Time bias for rotating Earth. Length of time before the target orbit plane is over the landing site, seconds + + double bias, arg, beta, dlng, h; + + const double w_E = 7.292114942213369e-05; + + bias = w_E * dt_bias; + arg = Math.Cos(Incl) / Math.Cos(Lat); + + //Limit to 1.0 + if (Math.Abs(arg) > 1.0) + { + if (arg > 0.0) + { + beta = (Math.PI * 0.5); + } + else + { + beta = -(Math.PI * 0.5); + } + } + else + { + beta = Math.Asin(arg); + } + if (north == false) + { + beta = Math.PI - beta; + } + dlng = Math.Atan2(Math.Sin(Lat), Math.Cos(beta) / Math.Sin(beta)); + if (dlng < 0) + { + dlng = dlng + (Math.PI * 2); + } + if (Math.PI - beta < 0.0) + { + dlng = Math.PI + dlng; + } + h = Lng - dlng + bias; + if (h < 0) + { + h = h + (Math.PI * 2); + } + + return -_V(Math.Sin(Incl) * Math.Sin(h), -Math.Sin(Incl) * Math.Cos(h), Math.Cos(Incl)); + } + public OrbitTgtCalcOutput Calculate(OrbitTgtCalcOptions opt) { //Input: H insertion, H OMS-1, H OMS-2, insertion mode @@ -728,6 +791,27 @@ public OrbitTgtCalcOutput Calculate(OrbitTgtCalcOptions opt) solution.TGTMECOvel = V_MECO; solution.TGTMECOfpa = fpa * Defs.DEG; solution.TGTMECOinclination = opt.Inclination * Defs.DEG; + + if (opt.CalcIY) + { + // if target inclination outside allowed range, calculate new dt bias + double dt_bias = 300.0; + if (solution.TGTMECOinclination > opt.Inc_Max) + { + dt_bias += 30 * (solution.TGTMECOinclination - opt.Inc_Max); + solution.TGTMECOinclination = opt.Inc_Max; + } + else if (solution.TGTMECOinclination < opt.Inc_Min) + { + dt_bias -= 30 * (opt.Inc_Min - solution.TGTMECOinclination); + solution.TGTMECOinclination = opt.Inc_Min; + } + VECTOR3 IY_EF = CalculateEFIYVector( opt.Inclination, opt.Pad_Latitude * Defs.RAD, opt.Pad_Longitude * Defs.RAD, opt.Inclination < (65.0 * Defs.RAD), dt_bias ); + solution.TGTMECOIYx = IY_EF.x; + solution.TGTMECOIYy = IY_EF.y; + solution.TGTMECOIYz = IY_EF.z; + } + solution.TGTMECOap = apsides[0] - RADIUS_EARTH_EQUATOR; solution.TGTMECOpe = apsides[1] - RADIUS_EARTH_EQUATOR; diff --git a/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/SSV_LC39.cs b/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/SSV_LC39.cs index e27163fd..5f33c271 100644 --- a/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/SSV_LC39.cs +++ b/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/SSV_LC39.cs @@ -39,6 +39,7 @@ Date Developer 2025/05/10 GLS 2025/06/21 GLS 2025/10/02 GLS +2026/01/02 GLS ********************************************/ /**************************************************************************** This file is part of Space Shuttle Ultra Workbench @@ -66,13 +67,6 @@ namespace SSVMissionEditor.Model { class SSV_LC39 : OrbiterVessel { - public const double LC39A_LAT = 28.6083850;// deg - public const double LC39A_LON = -80.6040720;// deg - - public const double LC39B_LAT = 28.6272150;// deg - public const double LC39B_LON = -80.6208620;// deg - - public SSV_LC39( Mission mission ) { _class = "SSV_LC39"; @@ -85,16 +79,16 @@ public SSV_LC39( Mission mission ) statusplanet = "Earth"; if (mission.LaunchPad == Defs.strLC39A) { - poslon = LC39A_LON; - poslat = LC39A_LAT; + poslon = Defs.LC39A_LON; + poslat = Defs.LC39A_LAT; arotx = -180.0; aroty = 80.604; arotz = 118.608; } else { - poslon = LC39B_LON; - poslat = LC39B_LAT; + poslon = Defs.LC39B_LON; + poslat = Defs.LC39B_LAT; arotx = -180.0; aroty = 80.621; arotz = 118.627; diff --git a/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/SSV_SLC6.cs b/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/SSV_SLC6.cs index 501bb85e..c2f58bbb 100644 --- a/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/SSV_SLC6.cs +++ b/Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/SSV_SLC6.cs @@ -33,6 +33,7 @@ Date Developer 2025/05/10 GLS 2025/06/21 GLS 2025/10/02 GLS +2026/01/02 GLS ********************************************/ /**************************************************************************** This file is part of Space Shuttle Ultra Workbench @@ -62,9 +63,6 @@ namespace SSVMissionEditor.Model class SSV_SLC6 : OrbiterVessel { - public const double SLC6_LAT = 34.5808470;// deg - public const double SLC6_LON = -120.6259500;// deg - public SSV_SLC6( Mission mission ) { _class = "SSV_SLC6"; @@ -73,8 +71,8 @@ public SSV_SLC6( Mission mission ) statuslanded = true; statusplanet = "Earth"; - poslon = SLC6_LON; - poslat = SLC6_LAT; + poslon = Defs.SLC6_LON; + poslat = Defs.SLC6_LAT; heading = 270.0; alt = 16.0; diff --git a/Orbitersdk/Space Shuttle Vessel/Mission Editor/View/Launch.xaml b/Orbitersdk/Space Shuttle Vessel/Mission Editor/View/Launch.xaml index e521f85b..b819c44a 100644 --- a/Orbitersdk/Space Shuttle Vessel/Mission Editor/View/Launch.xaml +++ b/Orbitersdk/Space Shuttle Vessel/Mission Editor/View/Launch.xaml @@ -36,6 +36,8 @@ Date Developer 2025/06/21 GLS 2025/10/24 GLS 2025/11/16 GLS +2025/12/30 GLS +2026/01/02 GLS ******************************************-->