Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/Defs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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";

Expand Down
31 changes: 27 additions & 4 deletions Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/Mission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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";



Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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"] );
Expand Down Expand Up @@ -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 ////////
Expand Down Expand Up @@ -1751,6 +1764,16 @@ public bool Test( ref string str )
/// </summary>
public double MECO_FPA { get; set; }

/// <summary>
/// Earth–fixed plane switch
/// </summary>
public bool EF_PLANE_SW { get; set; }

/// <summary>
/// IYD
/// </summary>
public string IYD { get; set; }




Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace SSVMissionEditor
{
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down
16 changes: 5 additions & 11 deletions Orbitersdk/Space Shuttle Vessel/Mission Editor/Model/SSV_LC39.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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";
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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";
Expand All @@ -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;

Expand Down
Loading