From e921643ad05cd99b25657349bf8229e1c0c31bea Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Sun, 23 Feb 2025 18:14:58 -0500 Subject: [PATCH 01/17] make S1C connectorVessel and add touchdown points --- .../ProjectApollo/Build/VC2017/s1c.vcxproj | 2 + .../Build/VC2017/s1c.vcxproj.filters | 58 ++++++++++--------- .../samples/ProjectApollo/src_saturn/s1c.cpp | 51 ++++++++++------ .../samples/ProjectApollo/src_saturn/s1c.h | 16 ++++- 4 files changed, 82 insertions(+), 45 deletions(-) diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj index c4251474e9..d3ad651455 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj @@ -157,9 +157,11 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + + diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters index 7a9952f403..9d0f0e6a9e 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters @@ -1,27 +1,33 @@ - - - - - {ab9c79bf-a90d-463b-bbe7-20910397df34} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {9ab6e939-5a0a-45c7-957c-c6d51b8f6cc3} - h;hpp;hxx;hm;inl - - - {cf32f73c-c5b6-48f2-bf7e-a62d074102b9} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - - - Source Files - - - - - Header Files - - + + + + + {ab9c79bf-a90d-463b-bbe7-20910397df34} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {9ab6e939-5a0a-45c7-957c-c6d51b8f6cc3} + h;hpp;hxx;hm;inl + + + {cf32f73c-c5b6-48f2-bf7e-a62d074102b9} + ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp index 6465c43cc1..bb7be9bbeb 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp @@ -23,21 +23,10 @@ **************************************************************************/ // To force Orbitersdk.h to use in any compiler version -#pragma include_alias( , ) -#include "Orbitersdk.h" -#include "nasspdefs.h" -#include "nasspsound.h" - -#include "soundlib.h" #include "s1c.h" -#include -#include - - -S1C::S1C (OBJHANDLE hObj, int fmodel) : VESSEL2(hObj, fmodel) - +S1C::S1C (OBJHANDLE hObj, int fmodel) : ProjectApolloConnectorVessel(hObj, fmodel) { InitS1c(); } @@ -192,9 +181,8 @@ void S1C::clbkPostCreation() } void S1C::clbkSaveState (FILEHANDLE scn) - { - VESSEL2::clbkSaveState (scn); + VESSEL4::clbkSaveState (scn); oapiWriteScenario_int (scn, "MAINSTATE", GetMainState()); oapiWriteScenario_int (scn, "VECHNO", VehicleNo); @@ -223,7 +211,6 @@ typedef union } MainState; int S1C::GetMainState() - { MainState state; @@ -237,7 +224,6 @@ int S1C::GetMainState() } void S1C::AddEngines() - { int i; SURFHANDLE tex = oapiRegisterExhaustTexture ("ProjectApollo/Exhaust2"); @@ -431,8 +417,38 @@ void S1C::clbkLoadStateEx (FILEHANDLE scn, void *vstatus) void S1C::clbkSetClassCaps (FILEHANDLE cfg) { - VESSEL2::clbkSetClassCaps (cfg); + VESSEL4::clbkSetClassCaps (cfg); SetS1c(); + + double td_mass = 450000.0; + double td_width = 10.0; + double td_tdph = -20.955 - 3.0; + double td_height = 40.0; + + static DWORD ntdp = 4; + static TOUCHDOWNVTX td[4]; + double stiffness = (-1) * (td_mass * 9.80655) / (3 * -0.05); + double damping = 0.9 * (2 * sqrt(td_mass * stiffness)); + for (int i = 0; i < 4; i++) { + td[i].damping = damping; + td[i].mu = 3; + td[i].mu_lng = 3; + td[i].stiffness = stiffness; + } + td[0].pos.x = -cos(30 * RAD) * td_width; + td[0].pos.y = -sin(30 * RAD) * td_width; + td[0].pos.z = td_tdph; + td[1].pos.x = 0; + td[1].pos.y = 1 * td_width; + td[1].pos.z = td_tdph; + td[2].pos.x = cos(30 * RAD) * td_width; + td[2].pos.y = -sin(30 * RAD) * td_width; + td[2].pos.z = td_tdph; + td[3].pos.x = 0; + td[3].pos.y = 0; + td[3].pos.z = td_tdph + td_height; + + SetTouchdownPoints(td, ntdp); } void S1C::LoadMeshes(bool lowres) @@ -514,7 +530,6 @@ void S1C::SetState(S1CSettings &state) } void S1C::ShowS1c() - { SetEmptyMass(EmptyMass); diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h index b6788e0d14..44973c64fe 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h @@ -22,6 +22,20 @@ **************************************************************************/ +#pragma include_alias( , ) +#include "Orbitersdk.h" + +#include "nasspdefs.h" +#include "nasspsound.h" + +#include "soundlib.h" + +#include +#include + +#include "connector.h" + + // // Data structure passed from main vessel to S1c to configure stage. // @@ -100,7 +114,7 @@ enum S1cState /// \brief S1c stage simulation. /// \ingroup SepStages /// -class S1C : public VESSEL2 { +class S1C : public ProjectApolloConnectorVessel { public: /// From b1f4a88af7476fe826885ad7ec49c6f76dba3f37 Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Tue, 25 Feb 2025 21:17:41 -0500 Subject: [PATCH 02/17] update mass --- Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp index bb7be9bbeb..b7b0de06c8 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp @@ -50,8 +50,8 @@ void S1C::InitS1c() thg_retro = 0; thg_main = 0; - EmptyMass = 50000.0; - MainFuel = 5000.0; + EmptyMass = 137000.0; + MainFuel = 2077000.0; EngineNum = 5; RetrosFired = false; @@ -420,9 +420,9 @@ void S1C::clbkSetClassCaps (FILEHANDLE cfg) VESSEL4::clbkSetClassCaps (cfg); SetS1c(); - double td_mass = 450000.0; + double td_mass = 2214000.0; double td_width = 10.0; - double td_tdph = -20.955 - 3.0; + double td_tdph = -49.0; double td_height = 40.0; static DWORD ntdp = 4; From 5cc1966293b57041c166039db66919b4de727217 Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Tue, 25 Feb 2025 22:05:15 -0500 Subject: [PATCH 03/17] replace 0s with nullptr --- .../samples/ProjectApollo/src_saturn/s1c.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp index b7b0de06c8..760038e5ec 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp @@ -44,11 +44,11 @@ void S1C::InitS1c() State = SIC_STATE_HIDDEN; - ph_retro = 0; - ph_main = 0; + ph_retro = nullptr; + ph_main = nullptr; - thg_retro = 0; - thg_main = 0; + thg_retro = nullptr; + thg_main = nullptr; EmptyMass = 137000.0; MainFuel = 2077000.0; @@ -69,13 +69,13 @@ void S1C::InitS1c() CurrentThrust = 0.0; - hsat5stg1 = 0; - hsat5stg1low = 0; + hsat5stg1 = nullptr; + hsat5stg1low = nullptr; for (i = 0; i < 4; i++) - th_retro[i] = 0; + th_retro[i] = nullptr; - th_main[0] = 0; + th_main[0] = nullptr; } void S1C::SetS1c() From 305e9ed9133dcc85f400e1d214518a7a7ca10069 Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Tue, 25 Feb 2025 23:35:13 -0500 Subject: [PATCH 04/17] add default retro number. --- Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp index 760038e5ec..5ce3de2a54 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp @@ -53,6 +53,7 @@ void S1C::InitS1c() EmptyMass = 137000.0; MainFuel = 2077000.0; EngineNum = 5; + RetroNum = 4; RetrosFired = false; LowRes = false; From c32e11458aad7948f1f5906e488cb0d852d568fd Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Sat, 8 Mar 2025 21:07:05 -0500 Subject: [PATCH 05/17] add sicsystems, pyro and spsdk; have linker errors --- .../ProjectApollo/Build/VC2017/s1c.vcxproj | 4 +- .../Build/VC2017/s1c.vcxproj.filters | 6 +++ .../samples/ProjectApollo/src_saturn/s1c.cpp | 9 +++-- .../samples/ProjectApollo/src_saturn/s1c.h | 38 +++++++++++++++++++ 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj index d3ad651455..d4b1ec1ca8 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj @@ -135,7 +135,7 @@ orbiter.lib;orbitersdk.lib;%(AdditionalDependencies) ../../../../../Modules/ProjectApollo/s1c.dll true - ../../../../lib;../../../../XRSound%(AdditionalLibraryDirectories) + ../../../../lib;../../../../XRSound;.\Release\PanelSDK;%(AdditionalLibraryDirectories) LIBC;msvcirt;libci;%(IgnoreSpecificDefaultLibraries) .\Release\s1c/s1c.pdb false @@ -157,10 +157,12 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + + diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters index 9d0f0e6a9e..6b2096be91 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters @@ -21,6 +21,9 @@ Source Files + + Source Files + @@ -29,5 +32,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp index 5ce3de2a54..0979c8b2f4 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp @@ -38,7 +38,6 @@ S1C::~S1C() } void S1C::InitS1c() - { int i; @@ -111,7 +110,6 @@ void S1C::SetS1c() } void S1C::clbkPreStep(double simt, double simdt, double mjd) - { if (State == SIC_STATE_HIDDEN) { @@ -323,7 +321,6 @@ void S1C::AddEngines() } void S1C::SetMainState(int s) - { MainState state; @@ -336,7 +333,6 @@ void S1C::SetMainState(int s) } void S1C::clbkLoadStateEx (FILEHANDLE scn, void *vstatus) - { char *line; float flt; @@ -421,6 +417,7 @@ void S1C::clbkSetClassCaps (FILEHANDLE cfg) VESSEL4::clbkSetClassCaps (cfg); SetS1c(); + //This could be a function double td_mass = 2214000.0; double td_width = 10.0; double td_tdph = -49.0; @@ -450,6 +447,10 @@ void S1C::clbkSetClassCaps (FILEHANDLE cfg) td[3].pos.z = td_tdph + td_height; SetTouchdownPoints(td, ntdp); + //**** + + SICSIISepPyros = new Pyro("SICSIISepPyros", Panelsdk); + sicSystems = new SICSystems(this, th_main, ph_main, Pyro(*SICSIISepPyros), LaunchS, SShutS, CurrentThrust); } void S1C::LoadMeshes(bool lowres) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h index 44973c64fe..bc28bc9354 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h @@ -34,6 +34,9 @@ #include #include "connector.h" +#include "s1csystems.h" +#include "PanelSDK/PanelSDK.h" +#include "pyro.h" // @@ -107,6 +110,29 @@ enum S1cState S1C_STATE_WAITING ///< S1c is idle after motor burnout. }; +class S1C; + +class SICConnector : public Connector +{ +public: + SICConnector(); + ~SICConnector(); + + void SetSIC(S1C* sat) { OurVessel = sat; }; + +protected: + S1C* OurVessel; +}; + +class SICtoSIIConnector : public SICConnector +{ +public: + SICtoSIIConnector(); + ~SICtoSIIConnector(); + + bool ReceiveMessage(Connector* from, ConnectorMessage& m); +}; + /// /// This code simulates the S1c stage. Basically it simulates thrust decay if there is any fuel left, /// fires any retro rockets to push it away from the Saturn and then sits around waiting to be deleted. @@ -216,4 +242,16 @@ class S1C : public ProjectApolloConnectorVessel { THRUSTER_HANDLE th_retro[4], th_main[5]; THGROUP_HANDLE thg_retro, thg_main; PROPELLANT_HANDLE ph_retro, ph_main; + DOCKHANDLE hDockSII; // docking connector to S-II + + //Move us into the SICSystems class eventually + PanelSDK Panelsdk; + SICSystems* sicSystems; + Pyro* SICSIISepPyros; + SICtoSIIConnector sibSIVBConnector; + //***********************\\\ + + Sound LaunchS, SShutS; + + }; From 844d9028c606c6b3fa52ab5ae622e28473fabd6d Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Sat, 8 Mar 2025 21:38:58 -0500 Subject: [PATCH 06/17] fix some linker errors...but not all --- .../samples/ProjectApollo/Build/VC2017/s1c.vcxproj | 3 +++ .../ProjectApollo/Build/VC2017/s1c.vcxproj.filters | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj index d4b1ec1ca8..1a8ff8cef7 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj @@ -159,11 +159,14 @@ + + + diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters index 6b2096be91..e4b3cc017e 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters @@ -24,6 +24,9 @@ Source Files + + Source Files + @@ -32,8 +35,14 @@ Header Files + + Header Files + Header Files + + Header Files + \ No newline at end of file From ada76478e8c00e7d39da526154b7f890d1306a68 Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Sat, 8 Mar 2025 23:20:26 -0500 Subject: [PATCH 07/17] fix more linker errors --- Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj | 3 ++- .../samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj index 1a8ff8cef7..6a1a908056 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj @@ -132,7 +132,7 @@ 0x040c - orbiter.lib;orbitersdk.lib;%(AdditionalDependencies) + orbiter.lib;orbitersdk.lib;PanelSDK.lib;XRSound.lib;%(AdditionalDependencies) ../../../../../Modules/ProjectApollo/s1c.dll true ../../../../lib;../../../../XRSound;.\Release\PanelSDK;%(AdditionalLibraryDirectories) @@ -159,6 +159,7 @@ + diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters index e4b3cc017e..ab1e073781 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/s1c.vcxproj.filters @@ -27,6 +27,9 @@ Source Files + + Source Files + From f52768a0083116e4f3717c69f650a4d1c3603b08 Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Sun, 9 Mar 2025 08:59:50 -0400 Subject: [PATCH 08/17] actually impliment connector functions --- .../samples/ProjectApollo/src_saturn/s1c.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp index 0979c8b2f4..29dd812625 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp @@ -577,3 +577,24 @@ DLLCLBK void ovcExit (VESSEL *vessel) if (vessel) delete (S1C *)vessel; } + +SICConnector::SICConnector() +{ +} + +SICConnector::~SICConnector() +{ +} + +SICtoSIIConnector::SICtoSIIConnector() +{ +} + +SICtoSIIConnector::~SICtoSIIConnector() +{ +} + +bool SICtoSIIConnector::ReceiveMessage(Connector* from, ConnectorMessage& m) +{ + return false; +} From 6ce08e877d1a787d634aaaf3bcd592f3e93c41ec Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Sun, 9 Mar 2025 09:23:27 -0400 Subject: [PATCH 09/17] move TD points into their own init function --- .../samples/ProjectApollo/src_saturn/s1c.cpp | 65 ++++++++++--------- .../samples/ProjectApollo/src_saturn/s1c.h | 1 + 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp index 29dd812625..5181088a0d 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp @@ -417,37 +417,7 @@ void S1C::clbkSetClassCaps (FILEHANDLE cfg) VESSEL4::clbkSetClassCaps (cfg); SetS1c(); - //This could be a function - double td_mass = 2214000.0; - double td_width = 10.0; - double td_tdph = -49.0; - double td_height = 40.0; - - static DWORD ntdp = 4; - static TOUCHDOWNVTX td[4]; - double stiffness = (-1) * (td_mass * 9.80655) / (3 * -0.05); - double damping = 0.9 * (2 * sqrt(td_mass * stiffness)); - for (int i = 0; i < 4; i++) { - td[i].damping = damping; - td[i].mu = 3; - td[i].mu_lng = 3; - td[i].stiffness = stiffness; - } - td[0].pos.x = -cos(30 * RAD) * td_width; - td[0].pos.y = -sin(30 * RAD) * td_width; - td[0].pos.z = td_tdph; - td[1].pos.x = 0; - td[1].pos.y = 1 * td_width; - td[1].pos.z = td_tdph; - td[2].pos.x = cos(30 * RAD) * td_width; - td[2].pos.y = -sin(30 * RAD) * td_width; - td[2].pos.z = td_tdph; - td[3].pos.x = 0; - td[3].pos.y = 0; - td[3].pos.z = td_tdph + td_height; - - SetTouchdownPoints(td, ntdp); - //**** + SetupTouchdownPoints(); SICSIISepPyros = new Pyro("SICSIISepPyros", Panelsdk); sicSystems = new SICSystems(this, th_main, ph_main, Pyro(*SICSIISepPyros), LaunchS, SShutS, CurrentThrust); @@ -564,6 +534,39 @@ void S1C::ShowS1c() AddEngines(); } +void S1C::SetupTouchdownPoints() +{ + double td_mass = 2214000.0; + double td_width = 10.0; + double td_tdph = -49.0; + double td_height = 40.0; + + static DWORD ntdp = 4; + static TOUCHDOWNVTX td[4]; + double stiffness = (-1) * (td_mass * 9.80655) / (3 * -0.05); + double damping = 0.9 * (2 * sqrt(td_mass * stiffness)); + for (int i = 0; i < 4; i++) { + td[i].damping = damping; + td[i].mu = 3; + td[i].mu_lng = 3; + td[i].stiffness = stiffness; + } + td[0].pos.x = -cos(30 * RAD) * td_width; + td[0].pos.y = -sin(30 * RAD) * td_width; + td[0].pos.z = td_tdph; + td[1].pos.x = 0; + td[1].pos.y = 1 * td_width; + td[1].pos.z = td_tdph; + td[2].pos.x = cos(30 * RAD) * td_width; + td[2].pos.y = -sin(30 * RAD) * td_width; + td[2].pos.z = td_tdph; + td[3].pos.x = 0; + td[3].pos.y = 0; + td[3].pos.z = td_tdph + td_height; + + SetTouchdownPoints(td, ntdp); +} + DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel) { diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h index bc28bc9354..73fded6ec2 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h @@ -210,6 +210,7 @@ class S1C : public ProjectApolloConnectorVessel { void InitS1c(); void AddEngines(); void ShowS1c(); + void SetupTouchdownPoints(); int GetMainState(); void SetMainState(int s); From b8346b053c3452108b360db3e81fca116cd01700 Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Sun, 9 Mar 2025 13:00:39 -0400 Subject: [PATCH 10/17] add docking port --- Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp index 5181088a0d..8edd657f2e 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp @@ -32,9 +32,9 @@ S1C::S1C (OBJHANDLE hObj, int fmodel) : ProjectApolloConnectorVessel(hObj, fmode } S1C::~S1C() - { - // Nothing for now. + delete(SICSIISepPyros); + delete(sicSystems); } void S1C::InitS1c() @@ -76,6 +76,7 @@ void S1C::InitS1c() th_retro[i] = nullptr; th_main[0] = nullptr; + hDockSII = nullptr; } void S1C::SetS1c() @@ -412,12 +413,12 @@ void S1C::clbkLoadStateEx (FILEHANDLE scn, void *vstatus) } void S1C::clbkSetClassCaps (FILEHANDLE cfg) - { VESSEL4::clbkSetClassCaps (cfg); SetS1c(); SetupTouchdownPoints(); + hDockSII = CreateDock(_V(0.0, 0.0, 20.169), _V(0, 0, 1), _V(0, 1, 0)); SICSIISepPyros = new Pyro("SICSIISepPyros", Panelsdk); sicSystems = new SICSystems(this, th_main, ph_main, Pyro(*SICSIISepPyros), LaunchS, SShutS, CurrentThrust); From 4c581c85b6b6643da5170bd49465b76c439de0fa Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Sun, 9 Mar 2025 18:11:42 -0400 Subject: [PATCH 11/17] add new vessel for interstage --- .../Build/VC2017/Sat1C_Sat2Interstage.vcxproj | 174 ++++++++++++++++++ .../Sat1C_Sat2Interstage.vcxproj.filters | 27 +++ .../ProjectApollo/ProjectApollo2017.sln | 14 +- .../src_saturn/S1C_S2_IntStage.cpp | 32 ++++ .../src_saturn/S1C_S2_IntStage.h | 56 ++++++ 5 files changed, 301 insertions(+), 2 deletions(-) create mode 100644 Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj create mode 100644 Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj.filters create mode 100644 Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp create mode 100644 Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj b/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj new file mode 100644 index 0000000000..a4db2e51cc --- /dev/null +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj @@ -0,0 +1,174 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + 16.0 + Win32Proj + {05d59a66-6569-4f39-bd15-b541a2377c0c} + Sat1CSat2Interstage + 10.0.17763.0 + + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v141 + false + MultiByte + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + Sat1C_Sat2Interstage + ../../../../../Modules/ProjectApollo/ + .\Release\Sat1C_Sat2Interstage\ + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;SAT1CSAT2INTERSTAGE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + + + WIN32;NDEBUG;SAT1CSAT2INTERSTAGE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + NotUsing + stdafx.h + ../../src_aux;../../src_sys;../../src_mfd;../../src_lm;../../src_moon;../../src_csm;../../src_launch;../../src_landing;../../src_saturn;../../../../include;../../../../XRSound;%(AdditionalIncludeDirectories) + true + Speed + MultiThreaded + stdcpp17 + .\Release\Sat1C_Sat2Interstage/Sat1C_Sat2Interstage.pch + + + Windows + true + true + true + false + ../../../../../Modules/ProjectApollo/Saturn5.dll + .\Release\PanelSDK;../../../../lib;../../../../XRSound;../../../../lib/Lua;%(AdditionalLibraryDirectories) + + + + + Level3 + true + _DEBUG;SAT1CSAT2INTERSTAGE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + NDEBUG;SAT1CSAT2INTERSTAGE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + + + + + + \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj.filters b/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj.filters new file mode 100644 index 0000000000..a0dddbb815 --- /dev/null +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + + + Source Files + + + \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/ProjectApollo2017.sln b/Orbitersdk/samples/ProjectApollo/ProjectApollo2017.sln index d2c438840d..6730f4270d 100644 --- a/Orbitersdk/samples/ProjectApollo/ProjectApollo2017.sln +++ b/Orbitersdk/samples/ProjectApollo/ProjectApollo2017.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.35431.46 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.33027.164 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASTP", "Build\VC2017\ASTP.vcxproj", "{BAE34D87-5EAE-491C-AE6D-73B6B1E487D2}" EndProject @@ -90,6 +90,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EasepSWC", "Build\VC2017\Ea EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Flag", "Build\VC2017\Flag.vcxproj", "{D3D8D4F0-3779-49A6-AE7D-2813609D0B65}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sat1C_Sat2Interstage", "Build\VC2017\Sat1C_Sat2Interstage.vcxproj", "{05D59A66-6569-4F39-BD15-B541A2377C0C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -336,6 +338,14 @@ Global {D3D8D4F0-3779-49A6-AE7D-2813609D0B65}.Release|Win32.ActiveCfg = Release|Win32 {D3D8D4F0-3779-49A6-AE7D-2813609D0B65}.Release|Win32.Build.0 = Release|Win32 {D3D8D4F0-3779-49A6-AE7D-2813609D0B65}.Release|x64.ActiveCfg = Release|Win32 + {05D59A66-6569-4F39-BD15-B541A2377C0C}.Debug|Win32.ActiveCfg = Debug|Win32 + {05D59A66-6569-4F39-BD15-B541A2377C0C}.Debug|Win32.Build.0 = Debug|Win32 + {05D59A66-6569-4F39-BD15-B541A2377C0C}.Debug|x64.ActiveCfg = Debug|x64 + {05D59A66-6569-4F39-BD15-B541A2377C0C}.Debug|x64.Build.0 = Debug|x64 + {05D59A66-6569-4F39-BD15-B541A2377C0C}.Release|Win32.ActiveCfg = Release|Win32 + {05D59A66-6569-4F39-BD15-B541A2377C0C}.Release|Win32.Build.0 = Release|Win32 + {05D59A66-6569-4F39-BD15-B541A2377C0C}.Release|x64.ActiveCfg = Release|x64 + {05D59A66-6569-4F39-BD15-B541A2377C0C}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp new file mode 100644 index 0000000000..181a994d8b --- /dev/null +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp @@ -0,0 +1,32 @@ +/************************************************************************** + This file is part of Project Apollo - NASSP + Copyright 2025 + + ORBITER vessel module: Saturn V Interstage + + Project Apollo is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Project Apollo is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Project Apollo; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + See https://github.com/orbiternassp/NASSP/blob/Orbiter2016/NASSP-LICENSE.txt + for more details. + +**************************************************************************/ + +#include "S1C_S2_IntStage.h" + +S1C_S2_Interstage::S1C_S2_Interstage(OBJHANDLE hObj, int fmodel): ProjectApolloConnectorVessel(hObj, fmodel) +{ + SIIDock = nullptr; + SICDock = nullptr; +} \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h new file mode 100644 index 0000000000..557e1d2372 --- /dev/null +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h @@ -0,0 +1,56 @@ +/************************************************************************** + This file is part of Project Apollo - NASSP + Copyright 2025 + + ORBITER vessel module: Saturn V Interstage + + Project Apollo is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Project Apollo is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Project Apollo; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + See https://github.com/orbiternassp/NASSP/blob/Orbiter2016/NASSP-LICENSE.txt + for more details. + +**************************************************************************/ + +#if !defined(_PA_S1C_S2INTSTAGE_H) +#define _PA_S1C_S2INTSTAGE_H + + +#include "Orbitersdk.h" +#include "PanelSDK/PanelSDK.h" +#include "soundlib.h" +#include "nasspdefs.h" +#include "connector.h" //replace with interstage connector header. + + +class S1C_S2_Interstage : public ProjectApolloConnectorVessel { +public: + S1C_S2_Interstage(OBJHANDLE hObj, int fmodel); + virtual ~S1C_S2_Interstage(); + void InitS1C_S2_Interstage(); + void clbkPostCreation(); + void clbkSetClassCaps(FILEHANDLE cfg); + void clbkPreStep(double simt, double simdt, double mjd); + void clbkSaveState(FILEHANDLE scn); + void clbkLoadStateEx(FILEHANDLE scn, void* vstatus); + int clbkConsumeBufferedKey(DWORD key, bool down, char* kstate); + void clbkFocusChanged(bool getfocus, OBJHANDLE hNewVessel, OBJHANDLE hOldVessel); + void clbkGetRadiationForce(const VECTOR3& mflux, VECTOR3& F, VECTOR3& pos); + +protected: + DOCKHANDLE SIIDock, SICDock; + +}; + +#endif From fe2a7ce69262fd15d63a4b2bc34018a7bbcae639 Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Sun, 9 Mar 2025 21:49:44 -0400 Subject: [PATCH 12/17] linker errors fix'd --- .../Build/VC2017/Sat1C_Sat2Interstage.vcxproj | 12 ++++-- .../Sat1C_Sat2Interstage.vcxproj.filters | 6 +++ .../src_saturn/S1C_S2_IntStage.cpp | 40 +++++++++++++++++++ .../src_saturn/S1C_S2_IntStage.h | 9 ++--- 4 files changed, 58 insertions(+), 9 deletions(-) diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj b/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj index a4db2e51cc..aaf4ec9ba2 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj @@ -20,9 +20,11 @@ + + 16.0 @@ -114,15 +116,18 @@ WIN32;NDEBUG;SAT1CSAT2INTERSTAGE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true + false NotUsing stdafx.h ../../src_aux;../../src_sys;../../src_mfd;../../src_lm;../../src_moon;../../src_csm;../../src_launch;../../src_landing;../../src_saturn;../../../../include;../../../../XRSound;%(AdditionalIncludeDirectories) true Speed MultiThreaded - stdcpp17 + stdcpp14 .\Release\Sat1C_Sat2Interstage/Sat1C_Sat2Interstage.pch + .\Release\Sat1C_Sat2Interstage/ + .\Release\Sat1C_Sat2Interstage/ + .\Release\Sat1C_Sat2Interstage/ Windows @@ -130,8 +135,9 @@ true true false - ../../../../../Modules/ProjectApollo/Saturn5.dll + ../../../../../Modules/ProjectApollo/Sat1C_Sat2Interstage.dll .\Release\PanelSDK;../../../../lib;../../../../XRSound;../../../../lib/Lua;%(AdditionalLibraryDirectories) + ../../src_aux/dsound.lib;winmm.lib;PanelSDK.lib;orbiter.lib;orbitersdk.lib;lua5.1.lib;opengl32.lib;glu32.lib;../../src_aux/dinput8.lib;../../src_aux/dxguid.lib;WS2_32.lib;User32.lib;Gdi32.lib;XRSound.lib;%(AdditionalDependencies) diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj.filters b/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj.filters index a0dddbb815..7fb25bd5ba 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj.filters +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj.filters @@ -18,10 +18,16 @@ Header Files + + Header Files + Source Files + + Source Files + \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp index 181a994d8b..ba1f51159a 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp @@ -25,8 +25,48 @@ #include "S1C_S2_IntStage.h" +#define ORBITER_MODULE + S1C_S2_Interstage::S1C_S2_Interstage(OBJHANDLE hObj, int fmodel): ProjectApolloConnectorVessel(hObj, fmodel) { SIIDock = nullptr; SICDock = nullptr; +} + +S1C_S2_Interstage::~S1C_S2_Interstage() { + +} + +void S1C_S2_Interstage::clbkSetClassCaps(FILEHANDLE cfg) +{ +} + +void S1C_S2_Interstage::clbkPostCreation() +{ +} + +void S1C_S2_Interstage::clbkPreStep(double simt, double simdt, double mjd) +{ +} + +void S1C_S2_Interstage::clbkSaveState(FILEHANDLE scn) +{ +} + +void S1C_S2_Interstage::clbkLoadStateEx(FILEHANDLE scn, void* vstatus) +{ +} + +void S1C_S2_Interstage::clbkGetRadiationForce(const VECTOR3& mflux, VECTOR3& F, VECTOR3& pos) +{ +} + +DLLCLBK VESSEL* ovcInit(OBJHANDLE hvessel, int flightmodel) +{ + return new S1C_S2_Interstage(hvessel, flightmodel); +} + +DLLCLBK void ovcExit(VESSEL* vessel) +{ + delete (S1C_S2_Interstage*)vessel; } \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h index 557e1d2372..c6d2683c55 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h @@ -29,7 +29,6 @@ #include "Orbitersdk.h" #include "PanelSDK/PanelSDK.h" -#include "soundlib.h" #include "nasspdefs.h" #include "connector.h" //replace with interstage connector header. @@ -38,19 +37,17 @@ class S1C_S2_Interstage : public ProjectApolloConnectorVessel { public: S1C_S2_Interstage(OBJHANDLE hObj, int fmodel); virtual ~S1C_S2_Interstage(); - void InitS1C_S2_Interstage(); - void clbkPostCreation(); void clbkSetClassCaps(FILEHANDLE cfg); + void clbkPostCreation(); void clbkPreStep(double simt, double simdt, double mjd); void clbkSaveState(FILEHANDLE scn); void clbkLoadStateEx(FILEHANDLE scn, void* vstatus); - int clbkConsumeBufferedKey(DWORD key, bool down, char* kstate); - void clbkFocusChanged(bool getfocus, OBJHANDLE hNewVessel, OBJHANDLE hOldVessel); void clbkGetRadiationForce(const VECTOR3& mflux, VECTOR3& F, VECTOR3& pos); protected: DOCKHANDLE SIIDock, SICDock; - + PROPELLANT_HANDLE ULLAGE_PROP[8]; + THRUSTER_HANDLE ULLAGE_MOTORS[8]; }; #endif From 0b8db380f02b9df93c0be06406c134963b4a61c5 Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Sun, 9 Mar 2025 22:33:37 -0400 Subject: [PATCH 13/17] add mesh and classname --- Config/ProjectApollo/Sat1C_Sat2Interstage.cfg | 16 ++++++++++++++ .../src_saturn/S1C_S2_IntStage.cpp | 22 +++++++++++++++++-- .../src_saturn/S1C_S2_IntStage.h | 3 ++- 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 Config/ProjectApollo/Sat1C_Sat2Interstage.cfg diff --git a/Config/ProjectApollo/Sat1C_Sat2Interstage.cfg b/Config/ProjectApollo/Sat1C_Sat2Interstage.cfg new file mode 100644 index 0000000000..96d4815d0e --- /dev/null +++ b/Config/ProjectApollo/Sat1C_Sat2Interstage.cfg @@ -0,0 +1,16 @@ +; === Configuration file for vessel class Saturn 5 Interstage === +ClassName = Sat1C_Sat2Interstage +Module = ProjectApollo\Sat1C_Sat2Interstage +EnableFocus = TRUE +Size = 10.0 + +Mass = 1500 ; empty mass [kg] +COG_OverGround = 2.0 + +; === Atmospheric flight model === +CW = 0.5 1.1 2 2.4 +CrossSections = 50.35 53.75 11.19 +RotResistance = 2.0 2.0 2.0 +Inertia = 19.65 19.45 1.45 + +EnableFocus = FALSE diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp index ba1f51159a..19660318d4 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp @@ -29,8 +29,9 @@ S1C_S2_Interstage::S1C_S2_Interstage(OBJHANDLE hObj, int fmodel): ProjectApolloConnectorVessel(hObj, fmodel) { - SIIDock = nullptr; - SICDock = nullptr; + hSIIDock = nullptr; + hSICDock = nullptr; + Sat1C_Sat2InterstageMesh = nullptr; } S1C_S2_Interstage::~S1C_S2_Interstage() { @@ -39,10 +40,27 @@ S1C_S2_Interstage::~S1C_S2_Interstage() { void S1C_S2_Interstage::clbkSetClassCaps(FILEHANDLE cfg) { + VESSEL4::clbkSetClassCaps(cfg); + ClearMeshes(); + ClearThrusterDefinitions(); + ClearExhaustRefs(); + ClearAttExhaustRefs(); + + Sat1C_Sat2InterstageMesh = oapiLoadMeshGlobal("ProjectApollo/sat5intstg"); + //Sat1C_Sat2InterstageMesh = oapiLoadMeshGlobal("ProjectApollo/sat5intstg4"); + //Sat1C_Sat2InterstageMesh = oapiLoadMeshGlobal("ProjectApollo/sat5intstg8"); + + VECTOR3 mesh_dir = _V(0, 0, 0); + unsigned int meshidx = AddMesh(Sat1C_Sat2InterstageMesh, &mesh_dir); + SetMeshVisibilityMode(meshidx, MESHVIS_ALWAYS); + + hSIIDock = CreateDock(_V(0.0, 0.0, 2.1675), _V(0, 0, 1), _V(0, 1, 0)); + hSICDock = CreateDock(_V(0.0, 0.0, -3.3807), _V(0, 0, -1), _V(0, 1, 0)); } void S1C_S2_Interstage::clbkPostCreation() { + } void S1C_S2_Interstage::clbkPreStep(double simt, double simdt, double mjd) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h index c6d2683c55..7be9b87dfb 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h @@ -45,9 +45,10 @@ class S1C_S2_Interstage : public ProjectApolloConnectorVessel { void clbkGetRadiationForce(const VECTOR3& mflux, VECTOR3& F, VECTOR3& pos); protected: - DOCKHANDLE SIIDock, SICDock; + DOCKHANDLE hSIIDock, hSICDock; PROPELLANT_HANDLE ULLAGE_PROP[8]; THRUSTER_HANDLE ULLAGE_MOTORS[8]; + MESHHANDLE Sat1C_Sat2InterstageMesh; }; #endif From e7db6b5342ec08ef0850c4c7bfd4bf40349e5afa Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Sun, 9 Mar 2025 23:38:21 -0400 Subject: [PATCH 14/17] fix load error caused by overloaded load function --- Config/ProjectApollo/S1C_S2_Interstage.cfg | 4 +++ Config/ProjectApollo/Sat1C_Sat2Interstage.cfg | 16 ----------- .../Build/VC2017/Sat1C_Sat2Interstage.vcxproj | 14 +++++----- .../src_saturn/S1C_S2_IntStage.cpp | 27 +++++++++---------- .../src_saturn/S1C_S2_IntStage.h | 4 +-- 5 files changed, 25 insertions(+), 40 deletions(-) create mode 100644 Config/ProjectApollo/S1C_S2_Interstage.cfg delete mode 100644 Config/ProjectApollo/Sat1C_Sat2Interstage.cfg diff --git a/Config/ProjectApollo/S1C_S2_Interstage.cfg b/Config/ProjectApollo/S1C_S2_Interstage.cfg new file mode 100644 index 0000000000..9e48cfe445 --- /dev/null +++ b/Config/ProjectApollo/S1C_S2_Interstage.cfg @@ -0,0 +1,4 @@ +; === Configuration file for vessel class Saturn 5 Interstage === +ClassName = S1C_S2_Interstage +Module = ProjectApollo\S1C_S2_Interstage +EnableFocus = TRUE diff --git a/Config/ProjectApollo/Sat1C_Sat2Interstage.cfg b/Config/ProjectApollo/Sat1C_Sat2Interstage.cfg deleted file mode 100644 index 96d4815d0e..0000000000 --- a/Config/ProjectApollo/Sat1C_Sat2Interstage.cfg +++ /dev/null @@ -1,16 +0,0 @@ -; === Configuration file for vessel class Saturn 5 Interstage === -ClassName = Sat1C_Sat2Interstage -Module = ProjectApollo\Sat1C_Sat2Interstage -EnableFocus = TRUE -Size = 10.0 - -Mass = 1500 ; empty mass [kg] -COG_OverGround = 2.0 - -; === Atmospheric flight model === -CW = 0.5 1.1 2 2.4 -CrossSections = 50.35 53.75 11.19 -RotResistance = 2.0 2.0 2.0 -Inertia = 19.65 19.45 1.45 - -EnableFocus = FALSE diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj b/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj index aaf4ec9ba2..587907c918 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/Sat1C_Sat2Interstage.vcxproj @@ -83,9 +83,9 @@ false - Sat1C_Sat2Interstage + S1C_S2_Interstage ../../../../../Modules/ProjectApollo/ - .\Release\Sat1C_Sat2Interstage\ + .\Release\S1C_S2_Interstage\ true @@ -124,10 +124,10 @@ Speed MultiThreaded stdcpp14 - .\Release\Sat1C_Sat2Interstage/Sat1C_Sat2Interstage.pch - .\Release\Sat1C_Sat2Interstage/ - .\Release\Sat1C_Sat2Interstage/ - .\Release\Sat1C_Sat2Interstage/ + .\Release\Sat1C_Sat2Interstage/S1C_S2_Interstage.pch + .\Release\S1C_S2_Interstage/ + .\Release\S1C_S2_Interstage/ + .\Release\S1C_S2_Interstage/ Windows @@ -135,7 +135,7 @@ true true false - ../../../../../Modules/ProjectApollo/Sat1C_Sat2Interstage.dll + ../../../../../Modules/ProjectApollo/S1C_S2_Interstage.dll .\Release\PanelSDK;../../../../lib;../../../../XRSound;../../../../lib/Lua;%(AdditionalLibraryDirectories) ../../src_aux/dsound.lib;winmm.lib;PanelSDK.lib;orbiter.lib;orbitersdk.lib;lua5.1.lib;opengl32.lib;glu32.lib;../../src_aux/dinput8.lib;../../src_aux/dxguid.lib;WS2_32.lib;User32.lib;Gdi32.lib;XRSound.lib;%(AdditionalDependencies) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp index 19660318d4..d23a1b785b 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp @@ -40,14 +40,10 @@ S1C_S2_Interstage::~S1C_S2_Interstage() { void S1C_S2_Interstage::clbkSetClassCaps(FILEHANDLE cfg) { - VESSEL4::clbkSetClassCaps(cfg); - ClearMeshes(); - ClearThrusterDefinitions(); - ClearExhaustRefs(); - ClearAttExhaustRefs(); - - Sat1C_Sat2InterstageMesh = oapiLoadMeshGlobal("ProjectApollo/sat5intstg"); - //Sat1C_Sat2InterstageMesh = oapiLoadMeshGlobal("ProjectApollo/sat5intstg4"); + SetEmptyMass(1000.0); + SetSize(10.0); + //Sat1C_Sat2InterstageMesh = oapiLoadMeshGlobal("ProjectApollo/sat5intstg"); + Sat1C_Sat2InterstageMesh = oapiLoadMeshGlobal("ProjectApollo/sat5intstg4"); //Sat1C_Sat2InterstageMesh = oapiLoadMeshGlobal("ProjectApollo/sat5intstg8"); VECTOR3 mesh_dir = _V(0, 0, 0); @@ -69,15 +65,16 @@ void S1C_S2_Interstage::clbkPreStep(double simt, double simdt, double mjd) void S1C_S2_Interstage::clbkSaveState(FILEHANDLE scn) { + VESSEL4::clbkSaveState(scn); } -void S1C_S2_Interstage::clbkLoadStateEx(FILEHANDLE scn, void* vstatus) -{ -} - -void S1C_S2_Interstage::clbkGetRadiationForce(const VECTOR3& mflux, VECTOR3& F, VECTOR3& pos) -{ -} +//void S1C_S2_Interstage::clbkLoadStateEx(FILEHANDLE scn, void* vstatus) +//{ +//} +// +//void S1C_S2_Interstage::clbkGetRadiationForce(const VECTOR3& mflux, VECTOR3& F, VECTOR3& pos) +//{ +//} DLLCLBK VESSEL* ovcInit(OBJHANDLE hvessel, int flightmodel) { diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h index 7be9b87dfb..39c03b863d 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h @@ -41,8 +41,8 @@ class S1C_S2_Interstage : public ProjectApolloConnectorVessel { void clbkPostCreation(); void clbkPreStep(double simt, double simdt, double mjd); void clbkSaveState(FILEHANDLE scn); - void clbkLoadStateEx(FILEHANDLE scn, void* vstatus); - void clbkGetRadiationForce(const VECTOR3& mflux, VECTOR3& F, VECTOR3& pos); + //void clbkLoadStateEx(FILEHANDLE scn, void* vstatus); + //void clbkGetRadiationForce(const VECTOR3& mflux, VECTOR3& F, VECTOR3& pos); protected: DOCKHANDLE hSIIDock, hSICDock; From 5ac1c6c2c17aaafd41934198905f64d3442a961f Mon Sep 17 00:00:00 2001 From: indy91 Date: Fri, 7 Mar 2025 18:56:05 +0100 Subject: [PATCH 15/17] Use connector class for communication between all Saturn stages and the ground support equipment --- .../ProjectApollo/Build/VC2017/LC34.vcxproj | 2 + .../Build/VC2017/LC34.vcxproj.filters | 6 + .../ProjectApollo/Build/VC2017/LC37.vcxproj | 2 + .../Build/VC2017/LC37.vcxproj.filters | 6 + .../ProjectApollo/Build/VC2017/ML.vcxproj | 2 + .../Build/VC2017/ML.vcxproj.filters | 6 + .../ProjectApollo/src_csm/csmconnector.cpp | 221 ---- .../ProjectApollo/src_csm/satsystems.cpp | 4 + .../samples/ProjectApollo/src_csm/saturn.cpp | 68 -- .../samples/ProjectApollo/src_csm/saturn.h | 27 +- .../ProjectApollo/src_launch/IUUmbilical.cpp | 523 +++++--- .../ProjectApollo/src_launch/IUUmbilical.h | 53 +- .../src_launch/IUUmbilicalInterface.h | 65 +- .../ProjectApollo/src_launch/IU_ESE.cpp | 55 +- .../samples/ProjectApollo/src_launch/IU_ESE.h | 30 +- .../samples/ProjectApollo/src_launch/LC34.cpp | 148 +-- .../samples/ProjectApollo/src_launch/LC34.h | 29 +- .../samples/ProjectApollo/src_launch/LC37.cpp | 128 +- .../samples/ProjectApollo/src_launch/LC37.h | 29 +- .../samples/ProjectApollo/src_launch/ML.cpp | 225 ++-- .../samples/ProjectApollo/src_launch/ML.h | 31 +- .../ProjectApollo/src_launch/RCA110A.cpp | 165 ++- .../ProjectApollo/src_launch/RCA110A.h | 19 +- .../ProjectApollo/src_launch/SCMUmbilical.cpp | 53 - .../ProjectApollo/src_launch/SCMUmbilical.h | 26 +- .../ProjectApollo/src_launch/SIB_ESE.cpp | 2 +- .../ProjectApollo/src_launch/SIB_ESE.h | 3 +- .../ProjectApollo/src_launch/SIC_ESE.cpp | 4 +- .../ProjectApollo/src_launch/SIC_ESE.h | 4 +- .../ProjectApollo/src_launch/SI_ESE.cpp | 7 +- .../samples/ProjectApollo/src_launch/SI_ESE.h | 11 +- .../ProjectApollo/src_launch/TSMUmbilical.cpp | 53 - .../ProjectApollo/src_launch/TSMUmbilical.h | 25 +- .../src_launch/TailUmbilical.cpp | 92 +- .../ProjectApollo/src_launch/TailUmbilical.h | 32 +- .../src_launch/TailUmbilicalInterface.h | 9 +- .../samples/ProjectApollo/src_saturn/FCC.cpp | 76 +- .../IUAuxiliaryPowerDistributor.cpp | 4 +- .../src_saturn/IUControlDistributor.cpp | 28 +- .../samples/ProjectApollo/src_saturn/LVDA.cpp | 2 +- .../ProjectApollo/src_saturn/Saturn1b.cpp | 66 +- .../ProjectApollo/src_saturn/Saturn5.cpp | 132 +-- .../samples/ProjectApollo/src_saturn/eds.cpp | 209 ++-- .../samples/ProjectApollo/src_saturn/eds.h | 8 +- .../samples/ProjectApollo/src_saturn/iu.cpp | 1047 +++++++++++------ .../samples/ProjectApollo/src_saturn/iu.h | 201 ++-- .../samples/ProjectApollo/src_saturn/s1b.cpp | 102 +- .../samples/ProjectApollo/src_saturn/s1b.h | 31 - .../ProjectApollo/src_saturn/s1bsystems.cpp | 231 +++- .../ProjectApollo/src_saturn/s1bsystems.h | 49 +- .../ProjectApollo/src_saturn/s1csystems.cpp | 214 +++- .../ProjectApollo/src_saturn/s1csystems.h | 49 +- .../ProjectApollo/src_saturn/saturn1b.h | 12 - .../ProjectApollo/src_saturn/saturnv.h | 19 +- .../ProjectApollo/src_saturn/siisystems.cpp | 363 ++++++ .../ProjectApollo/src_saturn/siisystems.h | 111 +- .../samples/ProjectApollo/src_saturn/sivb.cpp | 253 +--- .../samples/ProjectApollo/src_saturn/sivb.h | 43 +- .../ProjectApollo/src_saturn/sivbsystems.cpp | 491 +++++++- .../ProjectApollo/src_saturn/sivbsystems.h | 78 ++ .../samples/ProjectApollo/src_sys/connector.h | 10 +- 61 files changed, 3435 insertions(+), 2559 deletions(-) diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC34.vcxproj b/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC34.vcxproj index 01cc669743..f7def42b83 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC34.vcxproj +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC34.vcxproj @@ -162,6 +162,7 @@ + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) @@ -185,6 +186,7 @@ + diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC34.vcxproj.filters b/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC34.vcxproj.filters index 0968fabc57..a40a513ffd 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC34.vcxproj.filters +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC34.vcxproj.filters @@ -48,6 +48,9 @@ Source Files + + Source Files + @@ -131,5 +134,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC37.vcxproj b/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC37.vcxproj index 62228a52fe..bde5c21892 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC37.vcxproj +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC37.vcxproj @@ -157,6 +157,7 @@ + @@ -169,6 +170,7 @@ + diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC37.vcxproj.filters b/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC37.vcxproj.filters index f114a475f9..37fb4e3f32 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC37.vcxproj.filters +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/LC37.vcxproj.filters @@ -45,6 +45,9 @@ Source Files + + Source Files + @@ -80,5 +83,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/ML.vcxproj b/Orbitersdk/samples/ProjectApollo/Build/VC2017/ML.vcxproj index dec5453e45..4695922506 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/ML.vcxproj +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/ML.vcxproj @@ -164,6 +164,7 @@ + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) @@ -190,6 +191,7 @@ + diff --git a/Orbitersdk/samples/ProjectApollo/Build/VC2017/ML.vcxproj.filters b/Orbitersdk/samples/ProjectApollo/Build/VC2017/ML.vcxproj.filters index bb4c27f00b..d41fcef815 100644 --- a/Orbitersdk/samples/ProjectApollo/Build/VC2017/ML.vcxproj.filters +++ b/Orbitersdk/samples/ProjectApollo/Build/VC2017/ML.vcxproj.filters @@ -54,6 +54,9 @@ Source Files + + Source Files + @@ -146,5 +149,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_csm/csmconnector.cpp b/Orbitersdk/samples/ProjectApollo/src_csm/csmconnector.cpp index 00ea941b02..dc03848f3a 100644 --- a/Orbitersdk/samples/ProjectApollo/src_csm/csmconnector.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_csm/csmconnector.cpp @@ -97,35 +97,6 @@ bool SaturnToIUCommandConnector::ReceiveMessage(Connector *from, ConnectorMessag } break; - case IULV_GET_GLOBAL_ORIENTATION: - if (OurVessel) - { - VECTOR3 *arot = static_cast (m.val1.pValue); - VECTOR3 ar; - - OurVessel->GetGlobalOrientation(ar); - - *arot = ar; - return true; - } - break; - - case IULV_GET_MASS: - if (OurVessel) - { - m.val1.dValue = OurVessel->GetMass(); - return true; - } - break; - - case IULV_GET_GRAVITY_REF: - if (OurVessel) - { - m.val1.hValue = OurVessel->GetGravityRef(); - return true; - } - break; - case IULV_GET_RELATIVE_POS: if (OurVessel) { @@ -158,22 +129,6 @@ bool SaturnToIUCommandConnector::ReceiveMessage(Connector *from, ConnectorMessag } break; - case IULV_GET_GLOBAL_VEL: - if (OurVessel) - { - OurVessel->GetGlobalVel(*(VECTOR3 *) m.val1.pValue); - return true; - } - break; - - case IULV_GET_WEIGHTVECTOR: - if (OurVessel) - { - m.val2.bValue = OurVessel->GetWeightVector(*(VECTOR3 *) m.val1.pValue); - return true; - } - break; - case IULV_GET_INERTIAL_ACCEL: if (OurVessel) { @@ -198,126 +153,6 @@ bool SaturnToIUCommandConnector::ReceiveMessage(Connector *from, ConnectorMessag } break; - case IULV_GET_MISSIONTIME: - if (OurVessel) - { - m.val1.dValue = OurVessel->GetMissionTime(); - return true; - } - break; - - case IULV_GET_SI_THRUST_OK: - if (OurVessel) - { - OurVessel->GetSIThrustOK((bool *)m.val1.pValue); - return true; - } - break; - - case IULV_GET_SII_THRUST_OK: - if (OurVessel) - { - OurVessel->GetSIIThrustOK((bool *)m.val1.pValue); - return true; - } - break; - - case IULV_GET_SIVB_THRUST_OK: - if (OurVessel) - { - m.val1.bValue = OurVessel->GetSIVBThrustOK(); - return true; - } - break; - - case IULV_GET_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF: - if (OurVessel) - { - m.val1.bValue = OurVessel->GetSIPropellantDepletionEngineCutoff(); - return true; - } - break; - - case IULV_GET_SI_INBOARD_ENGINE_OUT: - if (OurVessel) - { - m.val1.bValue = OurVessel->GetSIInboardEngineOut(); - return true; - } - break; - - case IULV_GET_SI_OUTBOARD_ENGINE_OUT: - if (OurVessel) - { - m.val1.bValue = OurVessel->GetSIOutboardEngineOut(); - return true; - } - break; - - case IULV_GET_SIB_LOW_LEVEL_SENSORS_DRY: - if (OurVessel) - { - m.val1.bValue = OurVessel->GetSIBLowLevelSensorsDry(); - return true; - } - break; - - case IULV_GET_SII_PROPELLANT_DEPLETION_ENGINE_CUTOFF: - if (OurVessel) - { - m.val1.bValue = OurVessel->GetSIIPropellantDepletionEngineCutoff(); - return true; - } - break; - - case IULV_GET_SII_FUEL_TANK_PRESSURE: - if (OurVessel) - { - m.val1.dValue = OurVessel->GetSIIFuelTankPressurePSI(); - return true; - } - break; - - case IULV_GET_SIVB_FUEL_TANK_PRESSURE: - if (OurVessel) - { - m.val1.dValue = OurVessel->GetSIVBFuelTankPressurePSI(); - return true; - } - break; - - case IULV_GET_SIVB_LOX_TANK_PRESSURE: - if (OurVessel) - { - m.val1.dValue = OurVessel->GetSIVBLOXTankPressurePSI(); - return true; - } - break; - - case IULV_SI_SWITCH_SELECTOR: - if (OurVessel) - { - OurVessel->SISwitchSelector(m.val1.iValue); - return true; - } - break; - - case IULV_SII_SWITCH_SELECTOR: - if (OurVessel) - { - OurVessel->SIISwitchSelector(m.val1.iValue); - return true; - } - break; - - case IULV_SIVB_SWITCH_SELECTOR: - if (OurVessel) - { - OurVessel->SIVBSwitchSelector(m.val1.iValue); - return true; - } - break; - case IULV_SEPARATE_STAGE: if (OurVessel) { @@ -334,62 +169,6 @@ bool SaturnToIUCommandConnector::ReceiveMessage(Connector *from, ConnectorMessag } break; - case IULV_SET_APS_ATTITUDE_ENGINE: - if (OurVessel) - { - OurVessel->SetAPSAttitudeEngine(m.val1.iValue, m.val2.bValue); - return true; - } - break; - - case IULV_SI_EDS_CUTOFF: - if (OurVessel) - { - OurVessel->SIEDSCutoff(m.val1.bValue); - return true; - } - break; - - case IULV_SII_EDS_CUTOFF: - if (OurVessel) - { - OurVessel->SIIEDSCutoff(m.val1.bValue); - return true; - } - break; - - case IULV_SIVB_EDS_CUTOFF: - if (OurVessel) - { - OurVessel->SIVBEDSCutoff(m.val1.bValue); - return true; - } - break; - - case IULV_SET_SI_THRUSTER_DIR: - if (OurVessel) - { - OurVessel->SetSIThrusterDir(m.val1.iValue, m.val2.dValue, m.val3.dValue); - return true; - } - break; - - case IULV_SET_SII_THRUSTER_DIR: - if (OurVessel) - { - OurVessel->SetSIIThrusterDir(m.val1.iValue, m.val2.dValue, m.val3.dValue); - return true; - } - break; - - case IULV_SET_SIVB_THRUSTER_DIR: - if (OurVessel) - { - OurVessel->SetSIVBThrusterDir(m.val1.dValue, m.val2.dValue); - return true; - } - break; - case IULV_CSM_SEPARATION_SENSED: if (OurVessel) { diff --git a/Orbitersdk/samples/ProjectApollo/src_csm/satsystems.cpp b/Orbitersdk/samples/ProjectApollo/src_csm/satsystems.cpp index 49c5c820de..7daed0b3ce 100644 --- a/Orbitersdk/samples/ProjectApollo/src_csm/satsystems.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_csm/satsystems.cpp @@ -2753,6 +2753,10 @@ void Saturn::CheckSaturnSystemsState() iu = 0; } } + else + { + sivb->GetSIVBIUConnector()->ConnectTo(iu->GetSIVBCommandConnector()); + } } void Saturn::CheckSMSystemsState() diff --git a/Orbitersdk/samples/ProjectApollo/src_csm/saturn.cpp b/Orbitersdk/samples/ProjectApollo/src_csm/saturn.cpp index 22af85622d..588d4ae336 100644 --- a/Orbitersdk/samples/ProjectApollo/src_csm/saturn.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_csm/saturn.cpp @@ -5007,21 +5007,6 @@ int Saturn::GetAGCAttitudeError(int axis) return 0; } -void Saturn::GetSIIThrustOK(bool *ok) -{ - for (int i = 0;i < 5;i++) - { - ok[i] = false; - } -} - -bool Saturn::GetSIVBThrustOK() -{ - if (stage != LAUNCH_STAGE_SIVB && stage != STAGE_ORBIT_SIVB) return false; - - return sivb->GetThrustOK(); -} - double Saturn::GetFirstStageThrust() { if (stage > PRELAUNCH_STAGE) return 0.0; @@ -5029,46 +5014,6 @@ double Saturn::GetFirstStageThrust() return THRUST_FIRST_VAC; } -double Saturn::GetSIVBFuelTankPressurePSI() -{ - if (sivb && stage < CSM_LEM_STAGE) - return sivb->GetLH2TankUllagePressurePSI(); - - return 0.0; -} - -double Saturn::GetSIVBLOXTankPressurePSI() -{ - if (sivb && stage < CSM_LEM_STAGE) - return sivb->GetLOXTankUllagePressurePSI(); - - return 0.0; -} - -bool Saturn::GetSIIPropellantDepletionEngineCutoff() -{ - return false; -} - -bool Saturn::GetSIBLowLevelSensorsDry() -{ - return false; -} - -void Saturn::SetSIVBThrusterDir(double yaw, double pitch) -{ - if (stage != LAUNCH_STAGE_SIVB && stage != STAGE_ORBIT_SIVB) return; - - sivb->SetThrusterDir(yaw, pitch); -} - -void Saturn::SIVBEDSCutoff(bool cut) -{ - if (stage != LAUNCH_STAGE_SIVB && stage != STAGE_ORBIT_SIVB) return; - - sivb->EDSEngineCutoff(cut); -} - bool Saturn::GetQBallPower() { return iuCommandConnector.GetQBallPower(); @@ -5079,14 +5024,6 @@ bool Saturn::GetQBallSimulateCmd() return iuCommandConnector.GetQBallSimulateCmd(); } -void Saturn::SetAPSAttitudeEngine(int n, bool on) -{ - if (n < 0 || n > 5) return; - if (stage != LAUNCH_STAGE_SIVB && stage != STAGE_ORBIT_SIVB) return; - - sivb->SetAPSAttitudeEngine(n, on); -} - bool Saturn::GetCMCSIVBTakeover() { if (LVGuidanceSwitch.GetState() == THREEPOSSWITCH_DOWN && agc.GetInputChannelBit(012, EnableSIVBTakeover)) @@ -5152,11 +5089,6 @@ void Saturn::SetContrailLevel(double level) contrailLevel = level; } -void Saturn::SIVBSwitchSelector(int channel) -{ - sivb->SwitchSelector(channel); -} - // Get checklist controller pointer ChecklistController *Saturn::GetChecklistControl() { diff --git a/Orbitersdk/samples/ProjectApollo/src_csm/saturn.h b/Orbitersdk/samples/ProjectApollo/src_csm/saturn.h index 201e0659e4..fcdb84e3d8 100644 --- a/Orbitersdk/samples/ProjectApollo/src_csm/saturn.h +++ b/Orbitersdk/samples/ProjectApollo/src_csm/saturn.h @@ -998,25 +998,7 @@ class Saturn: public ProjectApolloConnectorVessel, public PanelSwitchListener { double GetMissionTime() { return MissionTime; }; virtual double GetFirstStageThrust(); - virtual double GetSIIFuelTankPressurePSI() { return 0.0; } - double GetSIVBFuelTankPressurePSI(); - double GetSIVBLOXTankPressurePSI(); - - virtual void GetSIThrustOK(bool *ok) = 0; - virtual void GetSIIThrustOK(bool *ok); - bool GetSIVBThrustOK(); - virtual bool GetSIPropellantDepletionEngineCutoff() = 0; - virtual bool GetSIIPropellantDepletionEngineCutoff(); - virtual bool GetSIInboardEngineOut() = 0; - virtual bool GetSIOutboardEngineOut() = 0; - virtual bool GetSIBLowLevelSensorsDry(); - virtual void SetSIThrusterDir(int n, double yaw, double pitch) = 0; - virtual void SetSIIThrusterDir(int n, double yaw, double pitch) {}; - void SetSIVBThrusterDir(double yaw, double pitch); - void SetAPSAttitudeEngine(int n, bool on); - virtual void SIEDSCutoff(bool cut) = 0; - virtual void SIIEDSCutoff(bool cut) {}; - void SIVBEDSCutoff(bool cut); + virtual double GetSIThrustLevel() = 0; bool GetQBallPower(); bool GetQBallSimulateCmd(); @@ -1063,13 +1045,6 @@ class Saturn: public ProjectApolloConnectorVessel, public PanelSwitchListener { /// ChecklistController *GetChecklistControl(); - /// - /// \brief LVDC "Switch Selector" staging support utility function - /// - virtual void SISwitchSelector(int channel) = 0; - virtual void SIISwitchSelector(int channel) {} - void SIVBSwitchSelector(int channel); - // // CWS functions. // diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilical.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilical.cpp index 39abcc2ed6..72d7be753b 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilical.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilical.cpp @@ -26,288 +26,507 @@ See http://nassp.sourceforge.net/license/ for more details. #include "iu.h" #include "IUUmbilicalInterface.h" #include "IUUmbilical.h" +#include "IU_ESE.h" -IUUmbilical::IUUmbilical(IUUmbilicalInterface *ml) +IUESEToIUCommandConnector::IUESEToIUCommandConnector() { - IuUmb = ml; - iu = NULL; - IUUmbilicalConnected = false; + type = IUESE_IU_COMMAND; + ourIU_ESE = NULL; } -IUUmbilical::~IUUmbilical() +IUESEToIUCommandConnector::~IUESEToIUCommandConnector() { + } -void IUUmbilical::Connect(IU *iu) +bool IUESEToIUCommandConnector::ReceiveMessage(Connector *from, ConnectorMessage &m) { - if (iu) + // + // Sanity check. + // + + if (m.destination != type) { - this->iu = iu; - iu->ConnectUmbilical(this); - IUUmbilicalConnected = true; + return false; } -} -void IUUmbilical::Disconnect() -{ - if (!IUUmbilicalConnected) return; + IUESEMessageType messageType; - iu->DisconnectUmbilical(); - IUUmbilicalConnected = false; -} + messageType = (IUESEMessageType)m.messageType; -void IUUmbilical::AbortDisconnect() -{ - IUUmbilicalConnected = false; + switch (messageType) + { + case IU_IUESE_GET_COMMAND_VEHICLE_LIFTOFF_INDICATION_INHIBIT: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetCommandVehicleLiftoffIndicationInhibit(); + return true; + } + break; + case IU_IUESE_GET_EXCESSIVE_ROLL_RATE_AUTO_ABORT_INHIBIT: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetExcessiveRollRateAutoAbortInhibit(m.val1.iValue); + return true; + } + break; + case IU_IUESE_GET_EXCESSIVE_PITCH_YAW_RATE_AUTO_ABORT_INHIBIT: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetExcessivePitchYawRateAutoAbortInhibit(m.val1.iValue); + return true; + } + break; + case IU_IUESE_GET_TWO_ENGINE_OUT_AUTO_ABORT_INHIBIT: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetTwoEngineOutAutoAbortInhibit(m.val1.iValue); + return true; + } + break; + case IU_IUESE_GET_GSE_OVERRATE_SIMULATE: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetOverrateSimulate(m.val1.iValue); + return true; + } + break; + case IU_IUESE_GET_EDS_POWER_INHIBIT: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetEDSPowerInhibit(); + return true; + } + break; + case IU_IUESE_PAD_ABORT_REQUEST: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetEDSPadAbortRequest(); + return true; + } + break; + case IU_IUESE_GET_ENGINE_THRUST_INDICATION_ENABLE_INHIBIT_A: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetThrustOKIndicateEnableInhibitA(); + return true; + } + break; + case IU_IUESE_GET_ENGINE_THRUST_INDICATION_ENABLE_INHIBIT_B: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetThrustOKIndicateEnableInhibitB(); + return true; + } + break; + case IU_IUESE_GET_EDS_LIFTOFF_INHIBIT_A: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetEDSLiftoffInhibitA(); + return true; + } + break; + case IU_IUESE_GET_EDS_LIFTOFF_INHIBIT_B: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetEDSLiftoffInhibitB(); + return true; + } + break; + case IU_IUESE_GET_SI_BURN_MODE_SUBSTITUTE: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetSIBurnModeSubstitute(); + return true; + } + break; + case IU_IUESE_GET_GUIDANCE_REFERENCE_RELEASE: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetGuidanceReferenceRelease(); + return true; + } + break; + case IU_IUESE_GET_Q_BALL_SIMULATE_CMD: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetQBallSimulateCmd(); + return true; + } + break; + case IU_IUESE_GET_EDS_AUTO_ABORT_SIMULATE: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetEDSAutoAbortSimulate(m.val1.iValue); + return true; + } + break; + case IU_IUESE_GET_EDS_LV_CUTOFF_SIMULATE: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetEDSLVCutoffSimulate(m.val1.iValue); + return true; + } + break; + case IU_IUESE_GET_SIC_OUTBOARD_ENGINES_CANT_INHIBIT: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetSICOutboardEnginesCantInhibit(); + return true; + } + break; + case IU_IUESE_GET_SIC_OUTBOARD_ENGINES_CANT_SIMULATE: + if (ourIU_ESE) + { + m.val1.bValue = ourIU_ESE->GetSICOutboardEnginesCantSimulate(); + return true; + } + break; + } + return false; } -bool IUUmbilical::ESEGetCommandVehicleLiftoffIndicationInhibit() +void IUESEToIUCommandConnector::SetEDSLiftoffEnableA() { - return IuUmb->ESEGetCommandVehicleLiftoffIndicationInhibit(); -} + ConnectorMessage cm; -bool IUUmbilical::ESEGetSICOutboardEnginesCantInhibit() -{ - return IuUmb->ESEGetSICOutboardEnginesCantInhibit(); -} + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_SET_EDS_LIFTOFF_ENABLE_A; -bool IUUmbilical::ESEGetSICOutboardEnginesCantSimulate() -{ - return IuUmb->ESEGetSICOutboardEnginesCantSimulate(); + SendMessage(cm); } -bool IUUmbilical::ESEGetExcessiveRollRateAutoAbortInhibit(int n) +void IUESEToIUCommandConnector::SetEDSLiftoffEnableB() { - return IuUmb->ESEGetExcessiveRollRateAutoAbortInhibit(n); -} + ConnectorMessage cm; -bool IUUmbilical::ESEGetExcessivePitchYawRateAutoAbortInhibit(int n) -{ - return IuUmb->ESEGetExcessivePitchYawRateAutoAbortInhibit(n); -} + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_SET_EDS_LIFTOFF_ENABLE_B; -bool IUUmbilical::ESEGetTwoEngineOutAutoAbortInhibit(int n) -{ - return IuUmb->ESEGetTwoEngineOutAutoAbortInhibit(n); + SendMessage(cm); } -bool IUUmbilical::ESEGetGSEOverrateSimulate(int n) +void IUESEToIUCommandConnector::EDSLiftoffEnableReset() { - return IuUmb->ESEGetGSEOverrateSimulate(n); -} + ConnectorMessage cm; -bool IUUmbilical::ESEGetEDSPowerInhibit() -{ - return IuUmb->ESEGetEDSPowerInhibit(); -} + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_EDS_LIFTOFF_ENABLE_RESET; -bool IUUmbilical::ESEPadAbortRequest() -{ - return IuUmb->ESEPadAbortRequest(); + SendMessage(cm); } -bool IUUmbilical::ESEGetThrustOKIndicateEnableInhibitA() +void IUESEToIUCommandConnector::SwitchFCCPowerOn() { - return IuUmb->ESEGetThrustOKIndicateEnableInhibitA(); -} + ConnectorMessage cm; -bool IUUmbilical::ESEGetThrustOKIndicateEnableInhibitB() -{ - return IuUmb->ESEGetThrustOKIndicateEnableInhibitB(); -} + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_SET_FCC_POWER; + cm.val1.bValue = true; -bool IUUmbilical::ESEEDSLiftoffInhibitA() -{ - return IuUmb->ESEEDSLiftoffInhibitA(); + SendMessage(cm); } -bool IUUmbilical::ESEEDSLiftoffInhibitB() +void IUESEToIUCommandConnector::SwitchFCCPowerOff() { - return IuUmb->ESEEDSLiftoffInhibitB(); -} + ConnectorMessage cm; -bool IUUmbilical::ESEGetSIBurnModeSubstitute() -{ - return IuUmb->ESEGetSIBurnModeSubstitute(); -} + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_SET_FCC_POWER; + cm.val1.bValue = false; -bool IUUmbilical::ESEGetGuidanceReferenceRelease() -{ - return IuUmb->ESEGetGuidanceReferenceRelease(); + SendMessage(cm); } -bool IUUmbilical::ESEGetQBallSimulateCmd() +void IUESEToIUCommandConnector::SwitchQBallPowerOn() { - return IuUmb->ESEGetQBallSimulateCmd(); -} + ConnectorMessage cm; -bool IUUmbilical::ESEGetEDSAutoAbortSimulate(int n) -{ - return IuUmb->ESEGetEDSAutoAbortSimulate(n); -} + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_SET_Q_BALL_POWER; + cm.val1.bValue = true; -bool IUUmbilical::ESEGetEDSLVCutoffSimulate(int n) -{ - return IuUmb->ESEGetEDSLVCutoffSimulate(n); + SendMessage(cm); } -void IUUmbilical::SetEDSLiftoffEnableA() +void IUESEToIUCommandConnector::SwitchQBallPowerOff() { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_SET_Q_BALL_POWER; + cm.val1.bValue = false; - iu->GetEDS()->SetEDSLiftoffEnableA(); + SendMessage(cm); } -void IUUmbilical::SetEDSLiftoffEnableB() +void IUESEToIUCommandConnector::SetControlSignalProcessorPower(bool set) { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; - iu->GetEDS()->SetEDSLiftoffEnableB(); + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_SET_CONTROL_SIGNAL_PROCESSOR_POWER; + cm.val1.bValue = set; + + SendMessage(cm); } -void IUUmbilical::EDSLiftoffEnableReset() +void IUESEToIUCommandConnector::EDSGroupNo1Reset() { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_EDS_GROUP_NO_1_RESET; - iu->GetEDS()->LiftoffEnableReset(); + SendMessage(cm); } -void IUUmbilical::SwitchFCCPowerOn() +void IUESEToIUCommandConnector::EDSGroupNo2Reset() { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_EDS_GROUP_NO_2_RESET; - iu->GetControlDistributor()->SetFCCPower(true); + SendMessage(cm); } -void IUUmbilical::SwitchFCCPowerOff() +bool IUESEToIUCommandConnector::AllSIEnginesRunning() { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; - iu->GetControlDistributor()->SetFCCPower(false); + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_ALL_SI_ENGINES_RUNNING; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -void IUUmbilical::SwitchQBallPowerOn() +bool IUESEToIUCommandConnector::IsEDSUnsafeA() { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_IS_EDS_UNSAFE_A; - iu->GetControlDistributor()->SetQBallPower(true); + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -void IUUmbilical::SwitchQBallPowerOff() +bool IUESEToIUCommandConnector::IsEDSUnsafeB() { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_IS_EDS_UNSAFE_B; - iu->GetControlDistributor()->SetQBallPower(false); + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -bool IUUmbilical::AllSIEnginesRunning() +bool IUESEToIUCommandConnector::GetEDSSCCutoff1() { - if (!IUUmbilicalConnected) return false; - - return iu->GetEDS()->GetAllSIEnginesRunning(); + return GetEDSSCCutoff(1); } -bool IUUmbilical::IsEDSUnsafeA() +bool IUESEToIUCommandConnector::GetEDSSCCutoff2() { - if (!IUUmbilicalConnected) return false; - - return iu->GetEDS()->IsEDSUnsafeA(); + return GetEDSSCCutoff(2); } -bool IUUmbilical::IsEDSUnsafeB() +bool IUESEToIUCommandConnector::GetEDSSCCutoff3() { - if (!IUUmbilicalConnected) return false; - - return iu->GetEDS()->IsEDSUnsafeB(); + return GetEDSSCCutoff(3); } -bool IUUmbilical::GetEDSSCCutoff1() +bool IUESEToIUCommandConnector::GetEDSSCCutoff(int n) { - if (!IUUmbilicalConnected) return false; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_GET_EDS_SC_CUTOFF; + cm.val1.iValue = n; - return iu->GetEDS()->GetLVEnginesCutoffFromSC1(); + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -bool IUUmbilical::GetEDSSCCutoff2() +bool IUESEToIUCommandConnector::GetEDSAutoAbortBus() { - if (!IUUmbilicalConnected) return false; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_GET_EDS_AUTO_ABORT_BUS; - return iu->GetEDS()->GetLVEnginesCutoffFromSC2(); + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -bool IUUmbilical::GetEDSSCCutoff3() +bool IUESEToIUCommandConnector::GetEDSExcessiveRollRateIndication() { - if (!IUUmbilicalConnected) return false; + ConnectorMessage cm; - return iu->GetEDS()->GetLVEnginesCutoffFromSC3(); + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_GET_EDS_EXCESSIVE_ROLL_RATE_INDICATION; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -bool IUUmbilical::GetEDSAutoAbortBus() +bool IUESEToIUCommandConnector::GetEDSExcessivePitchYawRateIndication() { - if (!IUUmbilicalConnected) return false; + ConnectorMessage cm; - return iu->GetEDS()->GetAutoAbort(); + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_GET_EDS_EXCESSIVE_PITCH_YAW_RATE_INDICATION; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -bool IUUmbilical::GetEDSExcessiveRollRateIndication() +bool IUESEToIUCommandConnector::GetLVDCOutputRegisterDiscrete(int bit) { - if (!IUUmbilicalConnected) return false; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_GET_LVDC_OUTPUT_REGISTER_DISCRETE; + cm.val1.iValue = bit; - return iu->GetEDS()->GetExcessiveRollRateIndication(); + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -bool IUUmbilical::GetEDSExcessivePitchYawRateIndication() +bool IUESEToIUCommandConnector::FCCPowerIsOn() { - if (!IUUmbilicalConnected) return false; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_FCC_POWER_IS_ON; - return iu->GetEDS()->GetExcessivePitchYawRateIndication(); + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -bool IUUmbilical::GetLVDCOutputRegisterDiscrete(int bit) +void IUESEToIUCommandConnector::SwitchSelector(int stage, int channel) { - if (!IUUmbilicalConnected) return false; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_SWITCH_SELECTOR; + cm.val1.iValue = stage; + cm.val2.iValue = channel; - return iu->GetLVDA()->GetOutputRegisterBit(bit); + SendMessage(cm); } -bool IUUmbilical::FCCPowerIsOn() +void IUESEToIUCommandConnector::LVDCPrepareToLaunch() { - if (!IUUmbilicalConnected) return false; + ConnectorMessage cm; - return iu->GetControlDistributor()->GetFCCPowerOn(); + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_LVDC_PREPARE_TO_LAUNCH; + + SendMessage(cm); } -void IUUmbilical::SetControlSignalProcessorPower(bool set) +bool IUESEToIUCommandConnector::GetSCCutoffEnabledA() { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_EDS_SC_CUTOFF_ENABLE_A; - iu->GetControlDistributor()->SetControlSignalProcessorPowerOn(set); + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -void IUUmbilical::EDSGroupNo1Reset() +bool IUESEToIUCommandConnector::GetSCCutoffEnabledB() { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_EDS_SC_CUTOFF_ENABLE_B; - iu->GetControlDistributor()->ResetBus1(); + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -void IUUmbilical::EDSGroupNo2Reset() +bool IUESEToIUCommandConnector::GetLiftoffEnableA() { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_EDS_GET_LIFTOFF_ENABLE_A; - iu->GetControlDistributor()->ResetBus2(); + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -void IUUmbilical::SwitchSelector(int stage, int channel) +bool IUESEToIUCommandConnector::GetLiftoffEnableB() { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_EDS_GET_LIFTOFF_ENABLE_B; - iu->GetControlDistributor()->SwitchSelector(stage, channel); + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -void IUUmbilical::LVDCPrepareToLaunch() +void IUESEToIUCommandConnector::GetEDSAbortCommandToSC(bool *abort) { - if (!IUUmbilicalConnected) return; + ConnectorMessage cm; - iu->GetLVDA()->PrepareToLaunch(); + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IUESE_IU_EDS_GET_ABORT_TO_SC; + cm.val1.pValue = abort; + + if (SendMessage(cm)) + { + return; + } + + for (int i = 0; i < 6; i++) + { + abort[i] = false; + } } \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilical.h b/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilical.h index 00abb27565..0f3f99025f 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilical.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilical.h @@ -24,23 +24,21 @@ See http://nassp.sourceforge.net/license/ for more details. #pragma once -class IUUmbilicalInterface; -class IU; +#include "connector.h" -class IUUmbilical +class IU_ESE; + +//IU ESE to IU connector +class IUESEToIUCommandConnector : public Connector { public: - IUUmbilical(IUUmbilicalInterface *ml); - ~IUUmbilical(); - - bool IsIUUmbilicalConnected() { return IUUmbilicalConnected; } + IUESEToIUCommandConnector(); + ~IUESEToIUCommandConnector(); - void Connect(IU* iu); - void Disconnect(); - //Called by IU during a pad abort. Technically doesn't disconnect IU umbilical - virtual void AbortDisconnect(); + //IU to IU ESE + bool ReceiveMessage(Connector *from, ConnectorMessage &m); - //From ML to SLV + //IU ESE to IU void SetEDSLiftoffEnableA(); void SetEDSLiftoffEnableB(); void EDSLiftoffEnableReset(); @@ -64,29 +62,14 @@ class IUUmbilical bool FCCPowerIsOn(); void SwitchSelector(int stage, int channel); void LVDCPrepareToLaunch(); + bool GetSCCutoffEnabledA(); + bool GetSCCutoffEnabledB(); + bool GetLiftoffEnableA(); + bool GetLiftoffEnableB(); + void GetEDSAbortCommandToSC(bool *abort); - //From SLV to ML - virtual bool ESEGetCommandVehicleLiftoffIndicationInhibit(); - virtual bool ESEGetSICOutboardEnginesCantInhibit(); - virtual bool ESEGetSICOutboardEnginesCantSimulate(); - virtual bool ESEGetExcessiveRollRateAutoAbortInhibit(int n); - virtual bool ESEGetExcessivePitchYawRateAutoAbortInhibit(int n); - virtual bool ESEGetTwoEngineOutAutoAbortInhibit(int n); - virtual bool ESEGetGSEOverrateSimulate(int n); - virtual bool ESEGetEDSPowerInhibit(); - virtual bool ESEPadAbortRequest(); - virtual bool ESEGetThrustOKIndicateEnableInhibitA(); - virtual bool ESEGetThrustOKIndicateEnableInhibitB(); - virtual bool ESEEDSLiftoffInhibitA(); - virtual bool ESEEDSLiftoffInhibitB(); - virtual bool ESEGetSIBurnModeSubstitute(); - virtual bool ESEGetGuidanceReferenceRelease(); - virtual bool ESEGetQBallSimulateCmd(); - virtual bool ESEGetEDSAutoAbortSimulate(int n); - virtual bool ESEGetEDSLVCutoffSimulate(int n); + void SetIU_ESE(IU_ESE *iu_ese) { ourIU_ESE = iu_ese; }; protected: - IU* iu; - IUUmbilicalInterface* IuUmb; - - bool IUUmbilicalConnected; + bool GetEDSSCCutoff(int n); + IU_ESE *ourIU_ESE; }; \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilicalInterface.h b/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilicalInterface.h index 074227c869..fbe01ef04e 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilicalInterface.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/IUUmbilicalInterface.h @@ -24,27 +24,48 @@ See http://nassp.sourceforge.net/license/ for more details. #pragma once -class IUUmbilicalInterface +enum IUESEMessageType { -public: - virtual bool ESEGetCommandVehicleLiftoffIndicationInhibit() = 0; - virtual bool ESEGetExcessiveRollRateAutoAbortInhibit(int n) = 0; - virtual bool ESEGetExcessivePitchYawRateAutoAbortInhibit(int n) = 0; - virtual bool ESEGetTwoEngineOutAutoAbortInhibit(int n) = 0; - virtual bool ESEGetGSEOverrateSimulate(int n) = 0; - virtual bool ESEGetEDSPowerInhibit() = 0; - virtual bool ESEPadAbortRequest() = 0; - virtual bool ESEGetThrustOKIndicateEnableInhibitA() = 0; - virtual bool ESEGetThrustOKIndicateEnableInhibitB() = 0; - virtual bool ESEEDSLiftoffInhibitA() = 0; - virtual bool ESEEDSLiftoffInhibitB() = 0; - virtual bool ESEGetSIBurnModeSubstitute() = 0; - virtual bool ESEGetGuidanceReferenceRelease() = 0; - virtual bool ESEGetQBallSimulateCmd() = 0; - virtual bool ESEGetEDSAutoAbortSimulate(int n) = 0; - virtual bool ESEGetEDSLVCutoffSimulate(int n) = 0; - - //Saturn V only - virtual bool ESEGetSICOutboardEnginesCantInhibit() { return false; } - virtual bool ESEGetSICOutboardEnginesCantSimulate() { return false; } + IU_IUESE_GET_COMMAND_VEHICLE_LIFTOFF_INDICATION_INHIBIT, + IU_IUESE_GET_EXCESSIVE_ROLL_RATE_AUTO_ABORT_INHIBIT, + IU_IUESE_GET_EXCESSIVE_PITCH_YAW_RATE_AUTO_ABORT_INHIBIT, + IU_IUESE_GET_TWO_ENGINE_OUT_AUTO_ABORT_INHIBIT, + IU_IUESE_GET_GSE_OVERRATE_SIMULATE, + IU_IUESE_GET_EDS_POWER_INHIBIT, + IU_IUESE_PAD_ABORT_REQUEST, + IU_IUESE_GET_ENGINE_THRUST_INDICATION_ENABLE_INHIBIT_A, + IU_IUESE_GET_ENGINE_THRUST_INDICATION_ENABLE_INHIBIT_B, + IU_IUESE_GET_EDS_LIFTOFF_INHIBIT_A, + IU_IUESE_GET_EDS_LIFTOFF_INHIBIT_B, + IU_IUESE_GET_SI_BURN_MODE_SUBSTITUTE, + IU_IUESE_GET_GUIDANCE_REFERENCE_RELEASE, + IU_IUESE_GET_Q_BALL_SIMULATE_CMD, + IU_IUESE_GET_EDS_AUTO_ABORT_SIMULATE, + IU_IUESE_GET_EDS_LV_CUTOFF_SIMULATE, + IU_IUESE_GET_SIC_OUTBOARD_ENGINES_CANT_INHIBIT, + IU_IUESE_GET_SIC_OUTBOARD_ENGINES_CANT_SIMULATE, + IUESE_IU_SET_EDS_LIFTOFF_ENABLE_A, + IUESE_IU_SET_EDS_LIFTOFF_ENABLE_B, + IUESE_IU_EDS_LIFTOFF_ENABLE_RESET, + IUESE_IU_SET_FCC_POWER, + IUESE_IU_SET_Q_BALL_POWER, + IUESE_IU_SET_CONTROL_SIGNAL_PROCESSOR_POWER, + IUESE_IU_EDS_GROUP_NO_1_RESET, + IUESE_IU_EDS_GROUP_NO_2_RESET, + IUESE_IU_ALL_SI_ENGINES_RUNNING, + IUESE_IU_IS_EDS_UNSAFE_A, + IUESE_IU_IS_EDS_UNSAFE_B, + IUESE_IU_GET_EDS_SC_CUTOFF, + IUESE_IU_GET_EDS_AUTO_ABORT_BUS, + IUESE_IU_GET_EDS_EXCESSIVE_ROLL_RATE_INDICATION, + IUESE_IU_GET_EDS_EXCESSIVE_PITCH_YAW_RATE_INDICATION, + IUESE_IU_GET_LVDC_OUTPUT_REGISTER_DISCRETE, + IUESE_IU_FCC_POWER_IS_ON, + IUESE_IU_SWITCH_SELECTOR, + IUESE_IU_LVDC_PREPARE_TO_LAUNCH, + IUESE_IU_EDS_SC_CUTOFF_ENABLE_A, + IUESE_IU_EDS_SC_CUTOFF_ENABLE_B, + IUESE_IU_EDS_GET_LIFTOFF_ENABLE_A, + IUESE_IU_EDS_GET_LIFTOFF_ENABLE_B, + IUESE_IU_EDS_GET_ABORT_TO_SC, }; \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/IU_ESE.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/IU_ESE.cpp index b8d44e471a..016912fd55 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/IU_ESE.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/IU_ESE.cpp @@ -28,10 +28,10 @@ See http://nassp.sourceforge.net/license/ for more details. #include "LVDA.h" #include "IU_ESE.h" -IU_ESE::IU_ESE(IUUmbilical *IuUmb, LCCPadInterface *p) +IU_ESE::IU_ESE(LCCPadInterface *p) { - Umbilical = IuUmb; Pad = p; + iuESEToIUCommandConnector.SetIU_ESE(this); CommandVehicleLiftoffIndicationInhibit = true; ThrustOKIndicateEnableInhibitA = true; @@ -49,6 +49,12 @@ IU_ESE::IU_ESE(IUUmbilical *IuUmb, LCCPadInterface *p) QBallSimulateCmd = false; SwitchFCCPowerOn = false; SwitchFCCPowerOff = false; + OneEngineOutA = false; + SCCutoffEnableA = false; + SCCutoffEnableB = false; + LiftoffReset = false; + LiftoffEnableA = false; + LiftoffEnableB = false; for (int i = 0;i < 9;i++) { @@ -57,6 +63,7 @@ IU_ESE::IU_ESE(IUUmbilical *IuUmb, LCCPadInterface *p) for (int i = 0;i < 6;i++) { EDSAutoAbortSimulate[i] = false; + EDSAbortCommandToSC[i] = false; } for (int i = 0;i < 3;i++) { @@ -69,6 +76,11 @@ IU_ESE::IU_ESE(IUUmbilical *IuUmb, LCCPadInterface *p) LastMissionTime = 10000000.0; } +IU_ESE::~IU_ESE() +{ + iuESEToIUCommandConnector.Disconnect(); +} + void IU_ESE::SaveState(FILEHANDLE scn) { @@ -82,7 +94,7 @@ void IU_ESE::LoadState(FILEHANDLE scn) void IU_ESE::Timestep(double MissionTime, double simdt) { //FCC Power (MDI 0861, MDO 1823) - FCCPowerIsOn = Umbilical->FCCPowerIsOn(); + FCCPowerIsOn = iuESEToIUCommandConnector.FCCPowerIsOn(); if (Pad->SLCCGetOutputSignal(1823)) SwitchFCCPowerOn = true; @@ -93,28 +105,28 @@ void IU_ESE::Timestep(double MissionTime, double simdt) SwitchFCCPowerOff = false; if (SwitchFCCPowerOn && !SwitchFCCPowerOff) - Umbilical->SwitchFCCPowerOn(); + iuESEToIUCommandConnector.SwitchFCCPowerOn(); if (SwitchFCCPowerOff || (!SwitchFCCPowerOn && !SwitchFCCPowerOff)) - Umbilical->SwitchFCCPowerOff(); + iuESEToIUCommandConnector.SwitchFCCPowerOff(); //Q-Ball Power if (Pad->SLCCGetOutputSignal(492)) { - Umbilical->SwitchQBallPowerOn(); + iuESEToIUCommandConnector.SwitchQBallPowerOn(); } if (Pad->SLCCGetOutputSignal(493)) { - Umbilical->SwitchQBallPowerOff(); + iuESEToIUCommandConnector.SwitchQBallPowerOff(); } //EDS Group Reset if (Pad->SLCCGetOutputSignal(734)) { - Umbilical->EDSGroupNo1Reset(); + iuESEToIUCommandConnector.EDSGroupNo1Reset(); } if (Pad->SLCCGetOutputSignal(825)) { - Umbilical->EDSGroupNo2Reset(); + iuESEToIUCommandConnector.EDSGroupNo2Reset(); } //Q-Ball Simulate Command @@ -274,6 +286,15 @@ void IU_ESE::Timestep(double MissionTime, double simdt) else ThrustOKIndicateEnableInhibitB = false; + //Telemetry + OneEngineOutA = !iuESEToIUCommandConnector.AllSIEnginesRunning(); + SCCutoffEnableA = iuESEToIUCommandConnector.GetSCCutoffEnabledA(); + SCCutoffEnableB = iuESEToIUCommandConnector.GetSCCutoffEnabledB(); + LiftoffEnableA = iuESEToIUCommandConnector.GetLiftoffEnableA(); + LiftoffEnableB = iuESEToIUCommandConnector.GetLiftoffEnableB(); + LiftoffReset = !LiftoffEnableA && !LiftoffEnableB; + iuESEToIUCommandConnector.GetEDSAbortCommandToSC(EDSAbortCommandToSC); + //EDS Test if ((MissionTime >= -6900.0) && (LastMissionTime < -6900.0)) { @@ -324,11 +345,11 @@ void IU_ESE::Timestep(double MissionTime, double simdt) ThrustOKIndicateEnableInhibitB = false; SIBurnModeSubstitute = true; - EDSNotReady = Umbilical->IsEDSUnsafeA() || Umbilical->IsEDSUnsafeB() || !Umbilical->GetEDSSCCutoff1() || !Umbilical->GetEDSSCCutoff2() || !Umbilical->GetEDSSCCutoff3(); - EDSNotReady = EDSNotReady || Umbilical->GetEDSAutoAbortBus() || Umbilical->GetEDSExcessiveRollRateIndication() || Umbilical->GetEDSExcessivePitchYawRateIndication(); + EDSNotReady = iuESEToIUCommandConnector.IsEDSUnsafeA() || iuESEToIUCommandConnector.IsEDSUnsafeB() || !iuESEToIUCommandConnector.GetEDSSCCutoff1() || !iuESEToIUCommandConnector.GetEDSSCCutoff2() || !iuESEToIUCommandConnector.GetEDSSCCutoff3(); + EDSNotReady = EDSNotReady || iuESEToIUCommandConnector.GetEDSAutoAbortBus() || iuESEToIUCommandConnector.GetEDSExcessiveRollRateIndication() || iuESEToIUCommandConnector.GetEDSExcessivePitchYawRateIndication(); - InstrumentUnitReady = !Umbilical->GetLVDCOutputRegisterDiscrete(FiringCommitInhibit) && !Umbilical->GetLVDCOutputRegisterDiscrete(GuidanceReferenceFailureA) - && !Umbilical->GetLVDCOutputRegisterDiscrete(GuidanceReferenceFailureB) && !EDSNotReady; + InstrumentUnitReady = !iuESEToIUCommandConnector.GetLVDCOutputRegisterDiscrete(FiringCommitInhibit) && !iuESEToIUCommandConnector.GetLVDCOutputRegisterDiscrete(GuidanceReferenceFailureA) + && !iuESEToIUCommandConnector.GetLVDCOutputRegisterDiscrete(GuidanceReferenceFailureB) && !EDSNotReady; } LastMissionTime = MissionTime; @@ -349,7 +370,7 @@ void IU_ESE::SetEDSMode(int mode) ThrustOKIndicateEnableInhibitA = true; ThrustOKIndicateEnableInhibitB = true; PadAbortRequest = false; - Umbilical->EDSLiftoffEnableReset(); + iuESEToIUCommandConnector.EDSLiftoffEnableReset(); } //Monitor else if (mode == LCC_EDS_MODE_MONITOR) @@ -361,7 +382,7 @@ void IU_ESE::SetEDSMode(int mode) ExcessivePitchYawRateAutoAbortInhibit[1] = true; ExcessivePitchYawRateAutoAbortInhibit[2] = true; EDSPowerInhibit = false; - Umbilical->EDSLiftoffEnableReset(); + iuESEToIUCommandConnector.EDSLiftoffEnableReset(); } //Test else if (mode == LCC_EDS_MODE_TEST) @@ -373,7 +394,7 @@ void IU_ESE::SetEDSMode(int mode) ExcessivePitchYawRateAutoAbortInhibit[1] = true; ExcessivePitchYawRateAutoAbortInhibit[2] = true; EDSPowerInhibit = false; - Umbilical->EDSLiftoffEnableReset(); + iuESEToIUCommandConnector.EDSLiftoffEnableReset(); } //Launch else if (mode == LCC_EDS_MODE_LAUNCH) @@ -442,7 +463,7 @@ bool IU_ESE::GetTwoEngineOutAutoAbortInhibit(int n) return false; } -IUSV_ESE::IUSV_ESE(IUUmbilical *IuUmb, LCCPadInterface *p) : IU_ESE(IuUmb, p) +IUSV_ESE::IUSV_ESE(LCCPadInterface *p) : IU_ESE(p) { SICOutboardEnginesCantInhibit = false; SICOutboardEnginesCantSimulate = false; diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/IU_ESE.h b/Orbitersdk/samples/ProjectApollo/src_launch/IU_ESE.h index eb48d3584f..57ee1597be 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/IU_ESE.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/IU_ESE.h @@ -24,9 +24,10 @@ See http://nassp.sourceforge.net/license/ for more details. #pragma once -class IUUmbilical; class LCCPadInterface; +#include "IUUmbilical.h" + #define LCC_EDS_MODE_OFF 0 #define LCC_EDS_MODE_MONITOR 1 #define LCC_EDS_MODE_TEST 2 @@ -35,7 +36,8 @@ class LCCPadInterface; class IU_ESE { public: - IU_ESE(IUUmbilical *IuUmb, LCCPadInterface *p); + IU_ESE(LCCPadInterface *p); + virtual ~IU_ESE(); void Timestep(double MissionTime, double simdt); void SaveState(FILEHANDLE scn); @@ -58,6 +60,17 @@ class IU_ESE bool GetQBallSimulateCmd() { return QBallSimulateCmd; } bool GetEDSAutoAbortSimulate(int n); bool GetEDSLVCutoffSimulate(int n); + virtual bool GetSICOutboardEnginesCantInhibit() { return false; } + virtual bool GetSICOutboardEnginesCantSimulate() { return false; } + + //IU ESE to ML + bool GetOneEngineOutA() { return OneEngineOutA; } + bool GetSCCutoffEnableA() { return SCCutoffEnableA; } + bool GetSCCutoffEnableB() { return SCCutoffEnableB; } + bool GetLiftoffReset() { return LiftoffReset; } + bool GetLiftoffEnableA() { return LiftoffEnableA; } + bool GetLiftoffEnableB() { return LiftoffEnableB; } + bool GetEDSAbortCommandToSC(int n) { return EDSAbortCommandToSC[n]; } void SetGuidanceReferenceRelease(bool set) { GuidanceReferenceRelease = set; } void SetEDSPowerInhibit(bool set) { EDSPowerInhibit = set; } @@ -66,6 +79,8 @@ class IU_ESE void SetEDSCutoffFromSC(int n, bool set) { EDSCutoffFromSC[n - 1] = set; } void SetThrustOKIndicateEnableInhibitA(bool set) { ThrustOKIndicateEnableInhibitA = set; } void SetThrustOKIndicateEnableInhibitB(bool set) { ThrustOKIndicateEnableInhibitB = set; } + + IUESEToIUCommandConnector* GetIUESEToIUCommandConnector() { return &iuESEToIUCommandConnector; } protected: void SetEDSMode(int mode); @@ -88,6 +103,13 @@ class IU_ESE bool SwitchFCCPowerOff; bool QBallSimulateCmd; bool EDSAutoAbortSimulate[6]; + bool EDSAbortCommandToSC[6]; + bool OneEngineOutA; + bool SCCutoffEnableA; + bool SCCutoffEnableB; + bool LiftoffReset; + bool LiftoffEnableA; + bool LiftoffEnableB; //Signals from LV bool FCCPowerIsOn; @@ -97,14 +119,14 @@ class IU_ESE double LastMissionTime = 0.0; - IUUmbilical *Umbilical; LCCPadInterface *Pad; + IUESEToIUCommandConnector iuESEToIUCommandConnector; }; class IUSV_ESE : public IU_ESE { public: - IUSV_ESE(IUUmbilical *IuUmb, LCCPadInterface *p); + IUSV_ESE(LCCPadInterface *p); bool GetSICOutboardEnginesCantInhibit() { return SICOutboardEnginesCantInhibit; } bool GetSICOutboardEnginesCantSimulate() { return SICOutboardEnginesCantSimulate; } diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/LC34.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/LC34.cpp index ef5f2230f7..049ebe1677 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/LC34.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/LC34.cpp @@ -35,7 +35,6 @@ #include "IUUmbilical.h" #include "IU_ESE.h" -#include "SCMUmbilical.h" #include "SIB_ESE.h" #include "LC34.h" #include "nasspdefs.h" @@ -48,6 +47,8 @@ #include "sivb.h" #include "papi.h" #include "RCA110A.h" +#include "iu.h" +#include "s1bsystems.h" HINSTANCE g_hDLL; char trace_file[] = "ProjectApollo LC34.log"; @@ -124,17 +125,13 @@ LC34::LC34(OBJHANDLE hObj, int fmodel) : VESSEL2 (hObj, fmodel) { //meshoffsetMSS = _V(0,0,0); - IuUmb = new IUUmbilical(this); - IuESE = new IU_ESE(IuUmb, this); - SCMUmb = new SCMUmbilical(this); - SIBESE = new SIB_ESE(SCMUmb, this); + IuESE = new IU_ESE(this); + SIBESE = new SIB_ESE(this); rca110a = new RCA110AM(this); } LC34::~LC34() { - delete IuUmb; delete IuESE; - delete SCMUmb; delete SIBESE; delete rca110a; } @@ -180,17 +177,17 @@ void LC34::clbkPostCreation() sat = (Saturn1b *)oapiGetVesselInterface(hLV); if (sat->GetStage() < LAUNCH_STAGE_ONE) { - IuUmb->Connect(sat->GetIU()); - SCMUmb->Connect(sat->GetSIB()); + IuESE->GetIUESEToIUCommandConnector()->ConnectTo(sat->GetIU()->GetIUToIUESECommandConnector()); + SIBESE->GetSIESEToSICommandConnector()->ConnectTo(sat->GetSIB()->GetSIBToSIESEConnector()); } } else if (!strcmp(SIBName, buffer)) { s1b = (S1B *)oapiGetVesselInterface(h); - SCMUmb->Connect(s1b->GetSIB()); + SIBESE->GetSIESEToSICommandConnector()->ConnectTo(s1b->GetSIB()->GetSIBToSIESEConnector()); } else if (!strcmp(SIVBName, buffer)) { sivb = (SIVB *)oapiGetVesselInterface(h); - IuUmb->Connect(sivb->GetIU()); + IuESE->GetIUESEToIUCommandConnector()->ConnectTo(sivb->GetIU()->GetIUToIUESECommandConnector()); } } } @@ -294,7 +291,7 @@ void LC34::clbkPreStep(double simt, double simdt, double mjd) } else { - IuUmb->LVDCPrepareToLaunch(); + IuESE->GetIUESEToIUCommandConnector()->LVDCPrepareToLaunch(); } // T-3.1s or later? @@ -337,7 +334,7 @@ void LC34::clbkPreStep(double simt, double simdt, double mjd) if (CutoffInterlock()) { Hold = true; - SCMUmb->SIGSECutoff(true); + SIBESE->GetSIESEToSICommandConnector()->SIGSECutoff(true); } else if (Hold == false) { @@ -353,23 +350,23 @@ void LC34::clbkPreStep(double simt, double simdt, double mjd) if (MissionTime > -3.1) { - SCMUmb->SetEngineStart(5); - SCMUmb->SetEngineStart(7); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(5); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(7); } if (MissionTime > -3.0) { - SCMUmb->SetEngineStart(6); - SCMUmb->SetEngineStart(8); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(6); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(8); } if (MissionTime > -2.9) { - SCMUmb->SetEngineStart(2); - SCMUmb->SetEngineStart(4); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(2); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(4); } if (MissionTime > -2.8) { - SCMUmb->SetEngineStart(1); - SCMUmb->SetEngineStart(3); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(1); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(3); } // T-1s or later? @@ -398,13 +395,13 @@ void LC34::clbkPreStep(double simt, double simdt, double mjd) //Cutoff if (MissionTime > 6.0 && (sat && sat->GetStage() <= PRELAUNCH_STAGE)) { - SCMUmb->SIGSECutoff(true); + SIBESE->GetSIESEToSICommandConnector()->SIGSECutoff(true); } if (CutoffInterlock()) { Hold = true; - SCMUmb->SIGSECutoff(true); + SIBESE->GetSIESEToSICommandConnector()->SIGSECutoff(true); } else if (Hold == false) { @@ -435,11 +432,11 @@ void LC34::clbkPreStep(double simt, double simdt, double mjd) if (bCommit) { // Activate liftoff circuit - IuUmb->SetEDSLiftoffEnableA(); - IuUmb->SetEDSLiftoffEnableB(); + IuESE->GetIUESEToIUCommandConnector()->SetEDSLiftoffEnableA(); + IuESE->GetIUESEToIUCommandConnector()->SetEDSLiftoffEnableB(); // Disconnect Umbilicals - IuUmb->Disconnect(); - SCMUmb->Disconnect(); + IuESE->GetIUESEToIUCommandConnector()->Disconnect(); + SIBESE->GetSIESEToSICommandConnector()->Disconnect(); // Move swingarms swingarmState.action = AnimState::OPENING; @@ -447,7 +444,7 @@ void LC34::clbkPreStep(double simt, double simdt, double mjd) else { Hold = true; - SCMUmb->SIGSECutoff(true); + SIBESE->GetSIESEToSICommandConnector()->SIGSECutoff(true); } } @@ -774,17 +771,17 @@ int LC34::clbkConsumeBufferedKey(DWORD key, bool down, char *kstate) { bool LC34::CutoffInterlock() { - if (IuUmb->IsEDSUnsafeA()) + if (IuESE->GetIUESEToIUCommandConnector()->IsEDSUnsafeA()) { oapiWriteLog("LC34: EDS Unsafe A signal received. Countdown Hold!"); return true; } - else if (IuUmb->IsEDSUnsafeB()) + else if (IuESE->GetIUESEToIUCommandConnector()->IsEDSUnsafeB()) { oapiWriteLog("LC34: EDS Unsafe B signal received. Countdown Hold!"); return true; } - else if (SCMUmb->SIStageLogicCutoff()) + else if (SIBESE->GetSIESEToSICommandConnector()->SIStageLogicCutoff()) { oapiWriteLog("LC34: S-I Stage Logic Cutoff signal received. Countdown Hold!"); return true; @@ -797,7 +794,7 @@ bool LC34::Commit() { if (!sat && (!s1b || !sivb)) return false; - if (IuUmb->AllSIEnginesRunning() == false) + if (IuESE->GetIUESEToIUCommandConnector()->AllSIEnginesRunning() == false) { oapiWriteLog("LC34: All Engines Running signal not received. Countdown Hold!"); return false; @@ -810,91 +807,6 @@ bool LC34::Commit() return true; } -bool LC34::ESEGetCommandVehicleLiftoffIndicationInhibit() -{ - return IuESE->GetCommandVehicleLiftoffIndicationInhibit(); -} - -bool LC34::ESEGetExcessiveRollRateAutoAbortInhibit(int n) -{ - return IuESE->GetExcessiveRollRateAutoAbortInhibit(n); -} - -bool LC34::ESEGetExcessivePitchYawRateAutoAbortInhibit(int n) -{ - return IuESE->GetExcessivePitchYawRateAutoAbortInhibit(n); -} - -bool LC34::ESEGetTwoEngineOutAutoAbortInhibit(int n) -{ - return IuESE->GetTwoEngineOutAutoAbortInhibit(n); -} - -bool LC34::ESEGetGSEOverrateSimulate(int n) -{ - return IuESE->GetOverrateSimulate(n); -} - -bool LC34::ESEGetEDSPowerInhibit() -{ - return IuESE->GetEDSPowerInhibit(); -} - -bool LC34::ESEPadAbortRequest() -{ - return IuESE->GetEDSPadAbortRequest(); -} - -bool LC34::ESEGetThrustOKIndicateEnableInhibitA() -{ - return IuESE->GetThrustOKIndicateEnableInhibitA(); -} - -bool LC34::ESEGetThrustOKIndicateEnableInhibitB() -{ - return IuESE->GetThrustOKIndicateEnableInhibitB(); -} - -bool LC34::ESEEDSLiftoffInhibitA() -{ - return IuESE->GetEDSLiftoffInhibitA(); -} - -bool LC34::ESEEDSLiftoffInhibitB() -{ - return IuESE->GetEDSLiftoffInhibitB(); -} - -bool LC34::ESEGetEDSAutoAbortSimulate(int n) -{ - return IuESE->GetEDSAutoAbortSimulate(n); -} - -bool LC34::ESEGetEDSLVCutoffSimulate(int n) -{ - return IuESE->GetEDSLVCutoffSimulate(n); -} - -bool LC34::ESEGetSIBurnModeSubstitute() -{ - return IuESE->GetSIBurnModeSubstitute(); -} - -bool LC34::ESEGetGuidanceReferenceRelease() -{ - return IuESE->GetGuidanceReferenceRelease(); -} - -bool LC34::ESEGetQBallSimulateCmd() -{ - return IuESE->GetQBallSimulateCmd(); -} - -bool LC34::ESEGetSIThrustOKSimulate(int eng, int n) -{ - return SIBESE->GetSIThrustOKSimulate(eng, n); -} - void LC34::SLCCCheckDiscreteInput(RCA110A *c) { c->SetInput(0, true); @@ -914,5 +826,5 @@ void LC34::ConnectGroundComputer(RCA110A *c) void LC34::IssueSwitchSelectorCmd(int stage, int chan) { - IuUmb->SwitchSelector(stage, chan); + IuESE->GetIUESEToIUCommandConnector()->SwitchSelector(stage, chan); } \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/LC34.h b/Orbitersdk/samples/ProjectApollo/src_launch/LC34.h index 07d98bf95f..8631f99f13 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/LC34.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/LC34.h @@ -24,23 +24,19 @@ #pragma once -#include "IUUmbilicalInterface.h" -#include "TailUmbilicalInterface.h" #include "LCCPadInterface.h" class S1B; class SIVB; class Saturn1b; -class IUUmbilical; class IU_ESE; -class SCMUmbilical; class SIB_ESE; class RCA110AM; /// /// \ingroup Ground /// -class LC34: public VESSEL2, public IUUmbilicalInterface, public TailUmbilicalInterface, public LCCPadInterface { +class LC34: public VESSEL2, public LCCPadInterface { public: LC34(OBJHANDLE hObj, int fmodel); @@ -55,27 +51,6 @@ class LC34: public VESSEL2, public IUUmbilicalInterface, public TailUmbilicalInt void clbkPreStep(double simt, double simdt, double mjd); void clbkPostStep(double simt, double simdt, double mjd); - // LC-34/IU Interface - bool ESEGetCommandVehicleLiftoffIndicationInhibit(); - bool ESEGetExcessiveRollRateAutoAbortInhibit(int n); - bool ESEGetExcessivePitchYawRateAutoAbortInhibit(int n); - bool ESEGetTwoEngineOutAutoAbortInhibit(int n); - bool ESEGetGSEOverrateSimulate(int n); - bool ESEGetEDSPowerInhibit(); - bool ESEPadAbortRequest(); - bool ESEGetThrustOKIndicateEnableInhibitA(); - bool ESEGetThrustOKIndicateEnableInhibitB(); - bool ESEEDSLiftoffInhibitA(); - bool ESEEDSLiftoffInhibitB(); - bool ESEGetEDSAutoAbortSimulate(int n); - bool ESEGetSIBurnModeSubstitute(); - bool ESEGetGuidanceReferenceRelease(); - bool ESEGetQBallSimulateCmd(); - bool ESEGetEDSLVCutoffSimulate(int n); - - //ML/S-IC Interface - bool ESEGetSIThrustOKSimulate(int eng, int n); - // LCC/ML Interface void SLCCCheckDiscreteInput(RCA110A *c); bool SLCCGetOutputSignal(size_t n); @@ -119,8 +94,6 @@ class LC34: public VESSEL2, public IUUmbilicalInterface, public TailUmbilicalInt Saturn1b *sat; S1B *s1b; SIVB *sivb; - IUUmbilical *IuUmb; - SCMUmbilical *SCMUmb; IU_ESE *IuESE; SIB_ESE *SIBESE; RCA110AM *rca110a; diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/LC37.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/LC37.cpp index cc7e5b1f59..2d43be7010 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/LC37.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/LC37.cpp @@ -34,7 +34,6 @@ #include "tracer.h" #include "IU_ESE.h" -#include "SCMUmbilical.h" #include "SIB_ESE.h" #include "IUUmbilical.h" #include "LC37.h" @@ -43,11 +42,13 @@ #include "apolloguidance.h" #include "LEMcomputer.h" #include "LEM.h" +#include "s1bsystems.h" #include "sivbsystems.h" #include "s1b.h" #include "sivb.h" #include "papi.h" #include "RCA110A.h" +#include "iu.h" HINSTANCE g_hDLL; @@ -114,17 +115,13 @@ LC37::LC37(OBJHANDLE hObj, int fmodel) : VESSEL2 (hObj, fmodel) { //meshoffsetMSS = _V(0,0,0); - IuUmb = new IUUmbilical(this); - IuESE = new IU_ESE(IuUmb, this); - SCMUmb = new SCMUmbilical(this); - SIBESE = new SIB_ESE(SCMUmb, this); + IuESE = new IU_ESE(this); + SIBESE = new SIB_ESE(this); rca110a = new RCA110AM(this); } LC37::~LC37() { - delete IuUmb; delete IuESE; - delete SCMUmb; delete SIBESE; delete rca110a; } @@ -156,11 +153,11 @@ void LC37::clbkPostCreation() oapiGetObjectName(h, buffer, 256); if (!strcmp(SIBName, buffer)) { s1b = (S1B *)oapiGetVesselInterface(h); - SCMUmb->Connect(s1b->GetSIB()); + SIBESE->GetSIESEToSICommandConnector()->ConnectTo(s1b->GetSIB()->GetSIBToSIESEConnector()); } else if (!strcmp(SIVBName, buffer)) { sivb = (SIVB *)oapiGetVesselInterface(h); - IuUmb->Connect(sivb->GetIU()); + IuESE->GetIUESEToIUCommandConnector()->ConnectTo(sivb->GetIU()->GetIUToIUESECommandConnector()); } } @@ -216,7 +213,7 @@ void LC37::clbkPreStep(double simt, double simdt, double mjd) } else { - IuUmb->LVDCPrepareToLaunch(); + IuESE->GetIUESEToIUCommandConnector()->LVDCPrepareToLaunch(); } if (MissionTime < -9) @@ -239,23 +236,23 @@ void LC37::clbkPreStep(double simt, double simdt, double mjd) if (MissionTime > -3.1) { - SCMUmb->SetEngineStart(5); - SCMUmb->SetEngineStart(7); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(5); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(7); } if (MissionTime > -3.0) { - SCMUmb->SetEngineStart(6); - SCMUmb->SetEngineStart(8); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(6); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(8); } if (MissionTime > -2.9) { - SCMUmb->SetEngineStart(2); - SCMUmb->SetEngineStart(4); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(2); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(4); } if (MissionTime > -2.8) { - SCMUmb->SetEngineStart(1); - SCMUmb->SetEngineStart(3); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(1); + SIBESE->GetSIESEToSICommandConnector()->SetEngineStart(3); } // T-1s or later? @@ -294,11 +291,11 @@ void LC37::clbkPreStep(double simt, double simdt, double mjd) // Disconnect IU Umbilical if (MissionTime >= -0.05) { // Activate liftoff circuit - IuUmb->SetEDSLiftoffEnableA(); - IuUmb->SetEDSLiftoffEnableB(); + IuESE->GetIUESEToIUCommandConnector()->SetEDSLiftoffEnableA(); + IuESE->GetIUESEToIUCommandConnector()->SetEDSLiftoffEnableB(); // Disconnect Umbilicals - IuUmb->Disconnect(); - SCMUmb->Disconnect(); + IuESE->GetIUESEToIUCommandConnector()->Disconnect(); + SIBESE->GetSIESEToSICommandConnector()->Disconnect(); } // T+4s or later? @@ -553,91 +550,6 @@ int LC37::clbkConsumeBufferedKey(DWORD key, bool down, char *kstate) { return 0; } -bool LC37::ESEGetCommandVehicleLiftoffIndicationInhibit() -{ - return IuESE->GetCommandVehicleLiftoffIndicationInhibit(); -} - -bool LC37::ESEGetExcessiveRollRateAutoAbortInhibit(int n) -{ - return IuESE->GetExcessiveRollRateAutoAbortInhibit(n); -} - -bool LC37::ESEGetExcessivePitchYawRateAutoAbortInhibit(int n) -{ - return IuESE->GetExcessivePitchYawRateAutoAbortInhibit(n); -} - -bool LC37::ESEGetTwoEngineOutAutoAbortInhibit(int n) -{ - return IuESE->GetTwoEngineOutAutoAbortInhibit(n); -} - -bool LC37::ESEGetGSEOverrateSimulate(int n) -{ - return IuESE->GetOverrateSimulate(n); -} - -bool LC37::ESEGetEDSPowerInhibit() -{ - return IuESE->GetEDSPowerInhibit(); -} - -bool LC37::ESEPadAbortRequest() -{ - return IuESE->GetEDSPadAbortRequest(); -} - -bool LC37::ESEGetThrustOKIndicateEnableInhibitA() -{ - return IuESE->GetThrustOKIndicateEnableInhibitA(); -} - -bool LC37::ESEGetThrustOKIndicateEnableInhibitB() -{ - return IuESE->GetThrustOKIndicateEnableInhibitB(); -} - -bool LC37::ESEEDSLiftoffInhibitA() -{ - return IuESE->GetEDSLiftoffInhibitA(); -} - -bool LC37::ESEEDSLiftoffInhibitB() -{ - return IuESE->GetEDSLiftoffInhibitB(); -} - -bool LC37::ESEGetEDSAutoAbortSimulate(int n) -{ - return IuESE->GetEDSAutoAbortSimulate(n); -} - -bool LC37::ESEGetEDSLVCutoffSimulate(int n) -{ - return IuESE->GetEDSLVCutoffSimulate(n); -} - -bool LC37::ESEGetSIBurnModeSubstitute() -{ - return IuESE->GetSIBurnModeSubstitute(); -} - -bool LC37::ESEGetGuidanceReferenceRelease() -{ - return IuESE->GetGuidanceReferenceRelease(); -} - -bool LC37::ESEGetQBallSimulateCmd() -{ - return IuESE->GetQBallSimulateCmd(); -} - -bool LC37::ESEGetSIThrustOKSimulate(int eng, int n) -{ - return SIBESE->GetSIThrustOKSimulate(eng, n); -} - void LC37::SLCCCheckDiscreteInput(RCA110A *c) { c->SetInput(0, true); @@ -657,5 +569,5 @@ void LC37::ConnectGroundComputer(RCA110A *c) void LC37::IssueSwitchSelectorCmd(int stage, int chan) { - IuUmb->SwitchSelector(stage, chan); + IuESE->GetIUESEToIUCommandConnector()->SwitchSelector(stage, chan); } \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/LC37.h b/Orbitersdk/samples/ProjectApollo/src_launch/LC37.h index be8c4f82b9..dee5240a48 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/LC37.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/LC37.h @@ -25,22 +25,18 @@ #pragma once #include "soundlib.h" -#include "IUUmbilicalInterface.h" -#include "TailUmbilicalInterface.h" #include "LCCPadInterface.h" class S1B; class SIVB; -class IUUmbilical; class IU_ESE; -class SCMUmbilical; class SIB_ESE; class RCA110AM; /// /// \ingroup Ground /// -class LC37: public VESSEL2, public IUUmbilicalInterface, public TailUmbilicalInterface, public LCCPadInterface { +class LC37: public VESSEL2, public LCCPadInterface { public: LC37(OBJHANDLE hObj, int fmodel); @@ -55,27 +51,6 @@ class LC37: public VESSEL2, public IUUmbilicalInterface, public TailUmbilicalInt void clbkPreStep(double simt, double simdt, double mjd); void clbkPostStep(double simt, double simdt, double mjd); - // LC-37/IU Interface - bool ESEGetCommandVehicleLiftoffIndicationInhibit(); - bool ESEGetExcessiveRollRateAutoAbortInhibit(int n); - bool ESEGetExcessivePitchYawRateAutoAbortInhibit(int n); - bool ESEGetTwoEngineOutAutoAbortInhibit(int n); - bool ESEGetGSEOverrateSimulate(int n); - bool ESEGetEDSPowerInhibit(); - bool ESEPadAbortRequest(); - bool ESEGetThrustOKIndicateEnableInhibitA(); - bool ESEGetThrustOKIndicateEnableInhibitB(); - bool ESEEDSLiftoffInhibitA(); - bool ESEEDSLiftoffInhibitB(); - bool ESEGetEDSAutoAbortSimulate(int n); - bool ESEGetEDSLVCutoffSimulate(int n); - bool ESEGetSIBurnModeSubstitute(); - bool ESEGetGuidanceReferenceRelease(); - bool ESEGetQBallSimulateCmd(); - - //ML/S-IC Interface - bool ESEGetSIThrustOKSimulate(int eng, int n); - // LCC/LC-37 Interface void SLCCCheckDiscreteInput(RCA110A *c); bool SLCCGetOutputSignal(size_t n); @@ -100,8 +75,6 @@ class LC37: public VESSEL2, public IUUmbilicalInterface, public TailUmbilicalInt void DefineAnimations(); void UpdateMissionTime(); - IUUmbilical *IuUmb; - SCMUmbilical *SCMUmb; IU_ESE *IuESE; SIB_ESE *SIBESE; RCA110AM *rca110a; diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/ML.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/ML.cpp index f6b2f141b4..d86f61ef0a 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/ML.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/ML.cpp @@ -37,11 +37,12 @@ #include "saturn.h" #include "papi.h" #include "IUUmbilical.h" -#include "TSMUmbilical.h" -#include "SCMUmbilical.h" #include "IU_ESE.h" #include "SIC_ESE.h" #include "SIB_ESE.h" +#include "iu.h" +#include "s1bsystems.h" +#include "s1csystems.h" HINSTANCE g_hDLL; char trace_file[] = "ProjectApollo ML.log"; @@ -150,17 +151,13 @@ ML::ML(OBJHANDLE hObj, int fmodel) : VESSEL2 (hObj, fmodel) { sat = NULL; - IuUmb = new IUUmbilical(this); - IuESE = new IUSV_ESE(IuUmb, this); + IuESE = new IUSV_ESE(this); SIESE = NULL; rca110a = new RCA110AM(this); - TailUmb = NULL; } ML::~ML() { - delete IuUmb; delete IuESE; - delete TailUmb; delete SIESE; delete rca110a; } @@ -190,13 +187,11 @@ void ML::clbkSetClassCaps(FILEHANDLE cfg) { if (IsSaturnV) { - TailUmb = new TSMUmbilical(this); - SIESE = new SIC_ESE(TailUmb, this); + SIESE = new SIC_ESE(this); } else { - TailUmb = new SCMUmbilical(this); - SIESE = new SIB_ESE(TailUmb, this); + SIESE = new SIB_ESE(this); } } @@ -215,10 +210,16 @@ void ML::clbkPostCreation() sat = (Saturn *)oapiGetVesselInterface(hLV); if (sat->GetStage() < LAUNCH_STAGE_ONE) { - IuUmb->Connect(sat->GetIU()); - - if (IsSaturnV) ((TSMUmbilical*)TailUmb)->Connect(sat->GetSIC()); - else ((SCMUmbilical*)TailUmb)->Connect(sat->GetSIB()); + IuESE->GetIUESEToIUCommandConnector()->ConnectTo(sat->GetIU()->GetIUToIUESECommandConnector()); + + if (IsSaturnV) + { + SIESE->GetSIESEToSICommandConnector()->ConnectTo(sat->GetSIC()->GetSICToSIESEConnector()); + } + else + { + SIESE->GetSIESEToSICommandConnector()->ConnectTo(sat->GetSIB()->GetSIBToSIESEConnector()); + } } } } @@ -564,7 +565,7 @@ void ML::clbkPreStep(double simt, double simdt, double mjd) { } else { - IuUmb->LVDCPrepareToLaunch(); + IuESE->GetIUESEToIUCommandConnector()->LVDCPrepareToLaunch(); } // T-16.2s or later? @@ -625,7 +626,7 @@ void ML::clbkPreStep(double simt, double simdt, double mjd) { if (CutoffInterlock()) { Hold = true; - TailUmb->SIGSECutoff(true); + SIESE->GetSIESEToSICommandConnector()->SIGSECutoff(true); } else if (Hold == false) { @@ -648,13 +649,13 @@ void ML::clbkPreStep(double simt, double simdt, double mjd) { //Cutoff if (sat->GetMissionTime() > 6.0 && sat->GetStage() <= PRELAUNCH_STAGE) { - TailUmb->SIGSECutoff(true); + SIESE->GetSIESEToSICommandConnector()->SIGSECutoff(true); } if (CutoffInterlock()) { Hold = true; - TailUmb->SIGSECutoff(true); + SIESE->GetSIESEToSICommandConnector()->SIGSECutoff(true); } else if (Hold == false) { @@ -675,11 +676,11 @@ void ML::clbkPreStep(double simt, double simdt, double mjd) { if (bCommit) { // Activate liftoff circuit - IuUmb->SetEDSLiftoffEnableA(); - IuUmb->SetEDSLiftoffEnableB(); + IuESE->GetIUESEToIUCommandConnector()->SetEDSLiftoffEnableA(); + IuESE->GetIUESEToIUCommandConnector()->SetEDSLiftoffEnableB(); // Disconnect Umbilicals - IuUmb->Disconnect(); - TailUmb->Disconnect(); + IuESE->GetIUESEToIUCommandConnector()->Disconnect(); + SIESE->GetSIESEToSICommandConnector()->Disconnect(); // Move swingarms OpenInflightSwingarms(); // Move masts @@ -688,7 +689,7 @@ void ML::clbkPreStep(double simt, double simdt, double mjd) { else { Hold = true; - TailUmb->SIGSECutoff(true); + SIESE->GetSIESEToSICommandConnector()->SIGSECutoff(true); } } @@ -1190,13 +1191,13 @@ int ML::clbkConsumeBufferedKey(DWORD key, bool down, char *kstate) { bool ML::CutoffInterlock() { - return (IuUmb->IsEDSUnsafeA() || IuUmb->IsEDSUnsafeB() || TailUmb->SIStageLogicCutoff()); + return (IuESE->GetIUESEToIUCommandConnector()->IsEDSUnsafeA() || IuESE->GetIUESEToIUCommandConnector()->IsEDSUnsafeB() || SIESE->GetSIESEToSICommandConnector()->SIStageLogicCutoff()); } bool ML::Commit() { if (!sat) return false; - return IuUmb->AllSIEnginesRunning() && !CutoffInterlock(); + return IuESE->GetIUESEToIUCommandConnector()->AllSIEnginesRunning() && !CutoffInterlock(); } void ML::HoldDownForce(double MissionTime) @@ -1267,29 +1268,29 @@ void ML::SaturnIBIgnitionSequence(double MissionTime) if (CutoffInterlock()) { Hold = true; - TailUmb->SIGSECutoff(true); + SIESE->GetSIESEToSICommandConnector()->SIGSECutoff(true); } else if (Hold == false) { if (MissionTime > -3.1) { - TailUmb->SetEngineStart(5); - TailUmb->SetEngineStart(7); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(5); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(7); } if (MissionTime > -3.0) { - TailUmb->SetEngineStart(6); - TailUmb->SetEngineStart(8); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(6); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(8); } if (MissionTime > -2.9) { - TailUmb->SetEngineStart(2); - TailUmb->SetEngineStart(4); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(2); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(4); } if (MissionTime > -2.8) { - TailUmb->SetEngineStart(1); - TailUmb->SetEngineStart(3); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(1); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(3); } // T-1s or later? @@ -1304,23 +1305,23 @@ void ML::SaturnVIgnitionSequence(double MissionTime) if (CutoffInterlock()) { Hold = true; - TailUmb->SIGSECutoff(true); + SIESE->GetSIESEToSICommandConnector()->SIGSECutoff(true); } else if (Hold == false) { if (MissionTime > -8.9) { - TailUmb->SetEngineStart(5); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(5); } if (MissionTime > -8.62) { - TailUmb->SetEngineStart(1); - TailUmb->SetEngineStart(3); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(1); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(3); } if (MissionTime > -8.2) { - TailUmb->SetEngineStart(2); - TailUmb->SetEngineStart(4); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(2); + SIESE->GetSIESEToSICommandConnector()->SetEngineStart(4); } // T-4.9s or later? @@ -1330,101 +1331,6 @@ void ML::SaturnVIgnitionSequence(double MissionTime) } } -bool ML::ESEGetCommandVehicleLiftoffIndicationInhibit() -{ - return IuESE->GetCommandVehicleLiftoffIndicationInhibit(); -} - -bool ML::ESEGetSICOutboardEnginesCantInhibit() -{ - return IuESE->GetSICOutboardEnginesCantInhibit(); -} - -bool ML::ESEGetSICOutboardEnginesCantSimulate() -{ - return IuESE->GetSICOutboardEnginesCantSimulate(); -} - -bool ML::ESEGetExcessiveRollRateAutoAbortInhibit(int n) -{ - return IuESE->GetExcessiveRollRateAutoAbortInhibit(n); -} - -bool ML::ESEGetExcessivePitchYawRateAutoAbortInhibit(int n) -{ - return IuESE->GetExcessivePitchYawRateAutoAbortInhibit(n); -} - -bool ML::ESEGetTwoEngineOutAutoAbortInhibit(int n) -{ - return IuESE->GetTwoEngineOutAutoAbortInhibit(n); -} - -bool ML::ESEGetGSEOverrateSimulate(int n) -{ - return IuESE->GetOverrateSimulate(n); -} - -bool ML::ESEGetEDSPowerInhibit() -{ - return IuESE->GetEDSPowerInhibit(); -} - -bool ML::ESEPadAbortRequest() -{ - return IuESE->GetEDSPadAbortRequest(); -} - -bool ML::ESEGetThrustOKIndicateEnableInhibitA() -{ - return IuESE->GetThrustOKIndicateEnableInhibitA(); -} - -bool ML::ESEGetThrustOKIndicateEnableInhibitB() -{ - return IuESE->GetThrustOKIndicateEnableInhibitB(); -} - -bool ML::ESEEDSLiftoffInhibitA() -{ - return IuESE->GetEDSLiftoffInhibitA(); -} - -bool ML::ESEEDSLiftoffInhibitB() -{ - return IuESE->GetEDSLiftoffInhibitB(); -} - -bool ML::ESEGetSIBurnModeSubstitute() -{ - return IuESE->GetSIBurnModeSubstitute(); -} - -bool ML::ESEGetGuidanceReferenceRelease() -{ - return IuESE->GetGuidanceReferenceRelease(); -} - -bool ML::ESEGetQBallSimulateCmd() -{ - return IuESE->GetQBallSimulateCmd(); -} - -bool ML::ESEGetEDSAutoAbortSimulate(int n) -{ - return IuESE->GetEDSAutoAbortSimulate(n); -} - -bool ML::ESEGetEDSLVCutoffSimulate(int n) -{ - return IuESE->GetEDSLVCutoffSimulate(n); -} - -bool ML::ESEGetSIThrustOKSimulate(int eng, int n) -{ - return SIESE->GetSIThrustOKSimulate(eng, n); -} - void ML::MobileLauncherComputer(int mdo, bool on) { switch (mdo) @@ -1442,12 +1348,12 @@ void ML::MobileLauncherComputer(int mdo, bool on) if (on) { IuESE->SetEDSLiftoffInhibitA(false); - IuUmb->SetEDSLiftoffEnableA(); + IuESE->GetIUESEToIUCommandConnector()->SetEDSLiftoffEnableA(); } else { IuESE->SetEDSLiftoffInhibitA(true); - IuUmb->EDSLiftoffEnableReset(); + IuESE->GetIUESEToIUCommandConnector()->EDSLiftoffEnableReset(); } break; case 738: @@ -1455,12 +1361,12 @@ void ML::MobileLauncherComputer(int mdo, bool on) if (on) { IuESE->SetEDSLiftoffInhibitB(false); - IuUmb->SetEDSLiftoffEnableB(); + IuESE->GetIUESEToIUCommandConnector()->SetEDSLiftoffEnableB(); } else { IuESE->SetEDSLiftoffInhibitB(true); - IuUmb->EDSLiftoffEnableReset(); + IuESE->GetIUESEToIUCommandConnector()->EDSLiftoffEnableReset(); } break; case 799: @@ -1484,7 +1390,7 @@ void ML::MobileLauncherComputer(int mdo, bool on) case 1584: //IVB MAIN STAGE OK SIM ON break; case 1903: //IU EDS RG SYSTEM POWER ON - IuUmb->SetControlSignalProcessorPower(on); + IuESE->GetIUESEToIUCommandConnector()->SetControlSignalProcessorPower(on); break; } } @@ -1690,9 +1596,38 @@ void ML::TerminalCountdownSequencer(double MissionTime) void ML::SLCCCheckDiscreteInput(RCA110A *c) { - c->SetInput(646, IuUmb->GetEDSAutoAbortBus()); - c->SetInput(647, IuUmb->IsEDSUnsafeA()); - c->SetInput(648, IuUmb->IsEDSUnsafeB()); + c->SetInput(600, IuESE->GetOneEngineOutA()); + c->SetInput(601, SIESE->GetSIThrustOK(1, 1)); + c->SetInput(602, SIESE->GetSIThrustOK(1, 2)); + c->SetInput(603, SIESE->GetSIThrustOK(1, 3)); + c->SetInput(604, SIESE->GetSIThrustOK(2, 1)); + c->SetInput(605, SIESE->GetSIThrustOK(2, 2)); + c->SetInput(606, SIESE->GetSIThrustOK(2, 3)); + c->SetInput(607, SIESE->GetSIThrustOK(3, 1)); + c->SetInput(608, SIESE->GetSIThrustOK(3, 2)); + c->SetInput(609, SIESE->GetSIThrustOK(3, 3)); + c->SetInput(610, SIESE->GetSIThrustOK(4, 1)); + c->SetInput(611, SIESE->GetSIThrustOK(4, 2)); + c->SetInput(612, SIESE->GetSIThrustOK(4, 3)); + c->SetInput(613, SIESE->GetSIThrustOK(5, 1)); + c->SetInput(614, SIESE->GetSIThrustOK(5, 2)); + c->SetInput(615, SIESE->GetSIThrustOK(5, 3)); + c->SetInput(616, IuESE->GetSCCutoffEnableA()); + c->SetInput(617, IuESE->GetSCCutoffEnableB()); + + c->SetInput(634, IuESE->GetLiftoffReset()); + c->SetInput(638, IuESE->GetLiftoffEnableA()); + c->SetInput(639, IuESE->GetLiftoffEnableB()); + c->SetInput(640, IuESE->GetEDSAbortCommandToSC(0)); + c->SetInput(641, IuESE->GetEDSAbortCommandToSC(1)); + c->SetInput(642, IuESE->GetEDSAbortCommandToSC(2)); + c->SetInput(643, IuESE->GetEDSAbortCommandToSC(3)); + c->SetInput(644, IuESE->GetEDSAbortCommandToSC(4)); + c->SetInput(645, IuESE->GetEDSAbortCommandToSC(5)); + c->SetInput(646, IuESE->GetIUESEToIUCommandConnector()->GetEDSAutoAbortBus()); + c->SetInput(647, IuESE->GetIUESEToIUCommandConnector()->IsEDSUnsafeA()); + c->SetInput(648, IuESE->GetIUESEToIUCommandConnector()->IsEDSUnsafeB()); + c->SetInput(861, IuESE->GetFCCPowerIsOn()); } @@ -1708,5 +1643,5 @@ void ML::ConnectGroundComputer(RCA110A *c) void ML::IssueSwitchSelectorCmd(int stage, int chan) { - IuUmb->SwitchSelector(stage, chan); + IuESE->GetIUESEToIUCommandConnector()->SwitchSelector(stage, chan); } \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/ML.h b/Orbitersdk/samples/ProjectApollo/src_launch/ML.h index cfa1026698..5ac3debf5b 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/ML.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/ML.h @@ -25,13 +25,9 @@ #pragma once #include "soundlib.h" -#include "IUUmbilicalInterface.h" -#include "TailUmbilicalInterface.h" #include "LCCPadInterface.h" class Saturn; -class IUUmbilical; -class TailUmbilical; class IUSV_ESE; class SI_ESE; class RCA110AM; @@ -52,7 +48,7 @@ const double DAMPERARM_RETRACT_SPEED = 1.0 / 30.0; /// /// \ingroup Ground /// -class ML: public VESSEL2, public IUUmbilicalInterface, public TailUmbilicalInterface, public LCCPadInterface { +class ML: public VESSEL2, public LCCPadInterface { public: ML(OBJHANDLE hObj, int fmodel); @@ -73,29 +69,6 @@ class ML: public VESSEL2, public IUUmbilicalInterface, public TailUmbilicalInter virtual bool Attach(); virtual bool IsInVAB(); - // ML/IU Interface - bool ESEGetCommandVehicleLiftoffIndicationInhibit(); - bool ESEGetSICOutboardEnginesCantInhibit(); - bool ESEGetSICOutboardEnginesCantSimulate(); - bool ESEGetExcessiveRollRateAutoAbortInhibit(int n); - bool ESEGetExcessivePitchYawRateAutoAbortInhibit(int n); - bool ESEGetTwoEngineOutAutoAbortInhibit(int n); - bool ESEGetGSEOverrateSimulate(int n); - bool ESEGetEDSPowerInhibit(); - bool ESEPadAbortRequest(); - bool ESEGetThrustOKIndicateEnableInhibitA(); - bool ESEGetThrustOKIndicateEnableInhibitB(); - bool ESEEDSLiftoffInhibitA(); - bool ESEEDSLiftoffInhibitB(); - bool ESEGetSIBurnModeSubstitute(); - bool ESEGetGuidanceReferenceRelease(); - bool ESEGetQBallSimulateCmd(); - bool ESEGetEDSAutoAbortSimulate(int n); - bool ESEGetEDSLVCutoffSimulate(int n); - - //ML/S-IC Interface - bool ESEGetSIThrustOKSimulate(int eng, int n); - // LCC/ML Interface void SLCCCheckDiscreteInput(RCA110A *c); bool SLCCGetOutputSignal(size_t n); @@ -142,8 +115,6 @@ class ML: public VESSEL2, public IUUmbilicalInterface, public TailUmbilicalInter double liftoffStreamLevel; Saturn *sat; - IUUmbilical *IuUmb; - TailUmbilical *TailUmb; IUSV_ESE *IuESE; SI_ESE *SIESE; RCA110AM *rca110a; diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/RCA110A.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/RCA110A.cpp index bad160a14d..243dcb1cc0 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/RCA110A.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/RCA110A.cpp @@ -98,7 +98,11 @@ bool ATOLLSequence::ReadIn(const char *str) int ATOLLSequence::GetOperator() { - if (Operator == "DISO") + if (Operator == "DISI") + { + return ATOLL_DISI; + } + else if (Operator == "DISO") { return ATOLL_DISO; } @@ -123,54 +127,96 @@ ATOLLProcessor::ATOLLProcessor(RCA110AL *r) rca110a = r; opcode = 0; nextitemtime = 0.0; - skipgetline = false; - delaystatus = false; + nextcommand = false; + DISINum = 0; + for (int i = 0; i < 5; i++) + { + DISIRef[i] = 0; + } + DISICondition = false; + halt = false; + firstpass = false; } void ATOLLProcessor::Timestep(double simt) { + //If file is not open, return if (ifs.is_open() == false) return; - + //Halt processing + if (halt) return; + //Save sim time simtime = simt; - if (simtime < nextitemtime) return; - if (skipgetline == false) + + opcode = seq.GetOperator(); + switch (opcode) { - if (!ifs.getline(line, 100)) - { - ifs.close(); - } + case ATOLL_DELY: + DELY(); + break; + case ATOLL_DISI: + DISI(); + break; + case ATOLL_DISO: + DISO(); + break; + case ATOLL_SCAN: + SCAN(); + break; + case ATOLL_SSEL: + SSEL(); + break; } - seq.Clear(); - if (seq.ReadIn(line)) + + //Halt processing + if (halt) return; + + if (nextcommand) { - opcode = seq.GetOperator(); - switch (opcode) - { - case ATOLL_DELY: - DELY(); - break; - case ATOLL_DISO: - DISO(); - break; - case ATOLL_SCAN: - SCAN(); - break; - case ATOLL_SSEL: - SSEL(); - break; - } + ProcessLine(); } } void ATOLLProcessor::DELY() { - if (seq.Time <= 0) return; - nextitemtime = simtime + seq.Time / 1000.0; + if (seq.Time <= 0) + { + nextcommand = true; + return; + } + + if (firstpass) + { + firstpass = false; + nextitemtime = simtime + seq.Time / 1000.0; + } + if (simtime >= nextitemtime) + { + nextcommand = true; + } +} + +void ATOLLProcessor::DISI() +{ + //Read reference profile and number of inputs + DISINum = sscanf(seq.Variable.c_str(), "D%d,D%d,D%d,D%d,D%d", &DISIRef[0], &DISIRef[1], &DISIRef[2], &DISIRef[3], &DISIRef[4]); + + if (DISINum == 0) + { + //Error + return; + } + + DISICondition = (seq.Condition == 1); + nextcommand = true; } void ATOLLProcessor::DISO() { - if (seq.Variable.size() == 0) return; + nextcommand = true; + if (seq.Variable.size() == 0) + { + return; + } if (seq.Variable[0] == 'D') { //Discrete output @@ -190,29 +236,47 @@ void ATOLLProcessor::DISO() void ATOLLProcessor::SCAN() { - if (seq.Time > 0) + if (firstpass) { - if (skipgetline == false) + firstpass = false; + if (seq.Time > 0) { nextitemtime = simtime + seq.Time / 1000.0; - skipgetline = true; - delaystatus = true; } else { - delaystatus = false; + nextitemtime = -HUGE_VAL; } } - if (delaystatus) return; + //Time to scan? + if (simtime < nextitemtime) return; + + //Yes, do Scanning + bool incorrect = false; + bool var; + + for (int i = 0; i < DISINum; i++) + { + var = rca110a->GetOutputSignal(DISIRef[i]); + + if (var != DISICondition) + { + incorrect = true; + break; + } + } - //Do Scanning - delaystatus = false; - skipgetline = false; + if (incorrect) + { + halt = true; + } + nextcommand = true; } void ATOLLProcessor::SSEL() { + nextcommand = true; int stage, chan; if (sscanf(seq.Variable.c_str(), "%d,%d", &stage, &chan) == 2) @@ -224,6 +288,27 @@ void ATOLLProcessor::SSEL() void ATOLLProcessor::ReadFile(const char *str) { ifs.open(str); + if (ifs.is_open()) + { + ifs.getline(line, 100); //To skip first line + halt = false; + nextitemtime = -HUGE_VAL; + //Read first line of file + ProcessLine(); + } +} + +void ATOLLProcessor::ProcessLine() +{ + if (!ifs.getline(line, 100)) + { + ifs.close(); + return; + } + seq.Clear(); + halt = !seq.ReadIn(line); + firstpass = true; + nextcommand = false; } RCA110A::RCA110A() diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/RCA110A.h b/Orbitersdk/samples/ProjectApollo/src_launch/RCA110A.h index ea889f8805..7ea5960a2d 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/RCA110A.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/RCA110A.h @@ -35,6 +35,7 @@ class LCCPadInterface; enum ATOLLOperators { + ATOLL_DISI, ATOLL_DISO, ATOLL_DELY, ATOLL_SCAN, @@ -72,10 +73,13 @@ class ATOLLProcessor private: //Operators void DELY(); + void DISI(); void DISO(); void SCAN(); void SSEL(); + void ProcessLine(); + ATOLLSequence seq; std::ifstream ifs; char line[128]; @@ -83,8 +87,17 @@ class ATOLLProcessor RCA110AL *rca110a; double nextitemtime; double simtime; - bool skipgetline; - bool delaystatus; + //Go to next command, set in the operators + bool nextcommand; + //First pass in a command + bool firstpass; + //Halt processing + bool halt; + + //Discrete Input Reference Profile + int DISIRef[5]; + int DISINum; + bool DISICondition; }; class RCA110A @@ -109,7 +122,7 @@ class RCA110A std::bitset inputdiscretes; std::bitset outputdiscretes; - //0 = nothing, 1 = single scan mode, 2 = continuous scan mode, 3 = monitor mode, 4 = monitor mode with selectable priority interruot + //0 = nothing, 1 = single scan mode, 2 = continuous scan mode, 3 = monitor mode, 4 = monitor mode with selectable priority interrupt int mode; }; diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/SCMUmbilical.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/SCMUmbilical.cpp index 2737ff1fe1..e4beb4bb84 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/SCMUmbilical.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/SCMUmbilical.cpp @@ -21,56 +21,3 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA See http://nassp.sourceforge.net/license/ for more details. **************************************************************************/ - -#include "Orbitersdk.h" -#include "s1bsystems.h" -#include "TailUmbilicalInterface.h" -#include "SCMUmbilical.h" - -SCMUmbilical::SCMUmbilical(TailUmbilicalInterface *ml) : TailUmbilical(ml) -{ - sib = NULL; -} - -SCMUmbilical::~SCMUmbilical() -{ -} - -void SCMUmbilical::Connect(SIBSystems *sib) -{ - if (sib) - { - this->sib = sib; - sib->ConnectUmbilical(this); - UmbilicalConnected = true; - } -} - -void SCMUmbilical::Disconnect() -{ - if (!UmbilicalConnected) return; - - sib->DisconnectUmbilical(); - UmbilicalConnected = false; -} - -bool SCMUmbilical::SIStageLogicCutoff() -{ - if (!UmbilicalConnected) return false; - - return sib->GetEngineStop(); -} - -void SCMUmbilical::SetEngineStart(int eng) -{ - if (!UmbilicalConnected) return; - - sib->SetEngineStart(eng); -} - -void SCMUmbilical::SIGSECutoff(bool cut) -{ - if (!UmbilicalConnected) return; - - sib->GSEEnginesCutoff(cut); -} \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/SCMUmbilical.h b/Orbitersdk/samples/ProjectApollo/src_launch/SCMUmbilical.h index 28808c6fd4..805b5f660c 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/SCMUmbilical.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/SCMUmbilical.h @@ -22,28 +22,4 @@ See http://nassp.sourceforge.net/license/ for more details. **************************************************************************/ -#pragma once - -#include "TailUmbilical.h" - -class SIBSystems; - -class SCMUmbilical : public TailUmbilical -{ -public: - SCMUmbilical(TailUmbilicalInterface *ml); - ~SCMUmbilical(); - - bool IsUmbilicalConnected() { return UmbilicalConnected; } - - void Connect(SIBSystems* sic); - void Disconnect(); - - //From ML to SLV - bool SIStageLogicCutoff(); - void SetEngineStart(int eng); - void SIGSECutoff(bool cut); - -protected: - SIBSystems* sib; -}; +#pragma once \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/SIB_ESE.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/SIB_ESE.cpp index a894b0dfef..02d3ea9340 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/SIB_ESE.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/SIB_ESE.cpp @@ -27,7 +27,7 @@ See http://nassp.sourceforge.net/license/ for more details. #include "LCCPadInterface.h" #include "SIB_ESE.h" -SIB_ESE::SIB_ESE(TailUmbilical *SCMUmb, LCCPadInterface *p) : SI_ESE(SCMUmb, p) +SIB_ESE::SIB_ESE(LCCPadInterface *p) : SI_ESE(p) { for (int i = 0;i < 8;i++) { diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/SIB_ESE.h b/Orbitersdk/samples/ProjectApollo/src_launch/SIB_ESE.h index bcb6a94cfe..1ea0b5ba40 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/SIB_ESE.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/SIB_ESE.h @@ -29,13 +29,14 @@ See http://nassp.sourceforge.net/license/ for more details. class SIB_ESE : public SI_ESE { public: - SIB_ESE(TailUmbilical *TSMUmb, LCCPadInterface *p); + SIB_ESE(LCCPadInterface *p); void Timestep(); void SaveState(FILEHANDLE scn); void LoadState(FILEHANDLE scn); bool GetSIThrustOKSimulate(int eng, int n) { return SIBThrustOKSimulate[eng - 1][n - 1]; } + bool GetSIThrustOK(int eng, int n) { return false; } protected: bool SIBThrustOKSimulate[8][3]; }; \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/SIC_ESE.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/SIC_ESE.cpp index 5c6ae8738e..25741e7f26 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/SIC_ESE.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/SIC_ESE.cpp @@ -27,13 +27,14 @@ See http://nassp.sourceforge.net/license/ for more details. #include "LCCPadInterface.h" #include "SIC_ESE.h" -SIC_ESE::SIC_ESE(TailUmbilical *TSMUmb, LCCPadInterface *p) : SI_ESE(TSMUmb, p) +SIC_ESE::SIC_ESE(LCCPadInterface *p) : SI_ESE(p) { for (int i = 0;i < 5;i++) { for (int j = 0;j < 3;j++) { SICThrustOKSimulate[i][j] = false; + SICThrustOK[i * 3 + j] = false; } } } @@ -54,6 +55,7 @@ void SIC_ESE::Timestep() } } } + siESEToSICommandConnector.GetSIThrustOK(SICThrustOK, 15); } void SIC_ESE::SaveState(FILEHANDLE scn) diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/SIC_ESE.h b/Orbitersdk/samples/ProjectApollo/src_launch/SIC_ESE.h index bf2279861e..e9406c937d 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/SIC_ESE.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/SIC_ESE.h @@ -29,13 +29,15 @@ See http://nassp.sourceforge.net/license/ for more details. class SIC_ESE : public SI_ESE { public: - SIC_ESE(TailUmbilical *TSMUmb, LCCPadInterface *p); + SIC_ESE(LCCPadInterface *p); void Timestep(); void SaveState(FILEHANDLE scn); void LoadState(FILEHANDLE scn); bool GetSIThrustOKSimulate(int eng, int n) { return SICThrustOKSimulate[eng - 1][n - 1]; } + bool GetSIThrustOK(int eng, int n) { return SICThrustOK[(eng - 1) * 3 + (n - 1)]; } protected: bool SICThrustOKSimulate[5][3]; + bool SICThrustOK[15]; }; \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/SI_ESE.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/SI_ESE.cpp index 1a58890ae9..b109e64215 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/SI_ESE.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/SI_ESE.cpp @@ -23,16 +23,15 @@ See http://nassp.sourceforge.net/license/ for more details. **************************************************************************/ #include "SI_ESE.h" -#include "TailUmbilical.h" #include "LCCPadInterface.h" -SI_ESE::SI_ESE(TailUmbilical *TailUmb, LCCPadInterface *p) +SI_ESE::SI_ESE(LCCPadInterface *p) { - Umbilical = TailUmb; + siESEToSICommandConnector.SetSI_ESE(this); Pad = p; } SI_ESE::~SI_ESE() { - + siESEToSICommandConnector.Disconnect(); } \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/SI_ESE.h b/Orbitersdk/samples/ProjectApollo/src_launch/SI_ESE.h index 90982f6986..e254707c9e 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/SI_ESE.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/SI_ESE.h @@ -24,23 +24,28 @@ See http://nassp.sourceforge.net/license/ for more details. #pragma once -class TailUmbilical; class LCCPadInterface; #include "Orbitersdk.h" +#include "TailUmbilical.h" class SI_ESE { public: - SI_ESE(TailUmbilical *TailUmb, LCCPadInterface *p); + SI_ESE(LCCPadInterface *p); virtual ~SI_ESE(); + //S-I ESE to S-I virtual bool GetSIThrustOKSimulate(int eng, int n) = 0; + //S-I ESE to ML + virtual bool GetSIThrustOK(int eng, int n) = 0; virtual void Timestep() = 0; virtual void SaveState(FILEHANDLE scn) = 0; virtual void LoadState(FILEHANDLE scn) = 0; + + SIESEToSICommandConnector* GetSIESEToSICommandConnector() { return &siESEToSICommandConnector; } protected: - TailUmbilical *Umbilical; + SIESEToSICommandConnector siESEToSICommandConnector; LCCPadInterface *Pad; }; \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/TSMUmbilical.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/TSMUmbilical.cpp index 0655981894..0716dc302c 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/TSMUmbilical.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/TSMUmbilical.cpp @@ -21,56 +21,3 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA See http://nassp.sourceforge.net/license/ for more details. **************************************************************************/ - -#include "Orbitersdk.h" -#include "s1csystems.h" -#include "TailUmbilicalInterface.h" -#include "TSMUmbilical.h" - -TSMUmbilical::TSMUmbilical(TailUmbilicalInterface *ml) : TailUmbilical(ml) -{ - sic = NULL; -} - -TSMUmbilical::~TSMUmbilical() -{ -} - -void TSMUmbilical::Connect(SICSystems *sic) -{ - if (sic) - { - this->sic = sic; - sic->ConnectUmbilical(this); - UmbilicalConnected = true; - } -} - -void TSMUmbilical::Disconnect() -{ - if (!UmbilicalConnected) return; - - sic->DisconnectUmbilical(); - UmbilicalConnected = false; -} - -bool TSMUmbilical::SIStageLogicCutoff() -{ - if (!UmbilicalConnected) return false; - - return sic->GetEngineStop(); -} - -void TSMUmbilical::SetEngineStart(int eng) -{ - if (!UmbilicalConnected) return; - - sic->SetEngineStart(eng); -} - -void TSMUmbilical::SIGSECutoff(bool cut) -{ - if (!UmbilicalConnected) return; - - sic->GSEEnginesCutoff(cut); -} \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/TSMUmbilical.h b/Orbitersdk/samples/ProjectApollo/src_launch/TSMUmbilical.h index 66fd9992d1..8a1d588176 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/TSMUmbilical.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/TSMUmbilical.h @@ -22,27 +22,4 @@ See http://nassp.sourceforge.net/license/ for more details. **************************************************************************/ -#pragma once - -#include "TailUmbilical.h" - -class SICSystems; - -class TSMUmbilical : public TailUmbilical -{ -public: - TSMUmbilical(TailUmbilicalInterface *ml); - ~TSMUmbilical(); - - bool IsUmbilicalConnected() { return UmbilicalConnected; } - - void Connect(SICSystems* sic); - void Disconnect(); - - //From ML to SLV - bool SIStageLogicCutoff(); - void SetEngineStart(int eng); - void SIGSECutoff(bool cut); -protected: - SICSystems* sic; -}; \ No newline at end of file +#pragma once \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilical.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilical.cpp index ba72a8dfcc..116ae50e00 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilical.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilical.cpp @@ -22,25 +22,103 @@ See http://nassp.sourceforge.net/license/ for more details. **************************************************************************/ +#include "Orbitersdk.h" #include "TailUmbilical.h" #include "TailUmbilicalInterface.h" +#include "SI_ESE.h" -TailUmbilical::TailUmbilical(TailUmbilicalInterface *ml) : TailUmb(ml) +SIESEToSICommandConnector::SIESEToSICommandConnector() { - UmbilicalConnected = false; + type = SIESE_SI_COMMAND; + ourSI_ESE = 0; } -TailUmbilical::~TailUmbilical() +SIESEToSICommandConnector::~SIESEToSICommandConnector() { } -void TailUmbilical::AbortDisconnect() +bool SIESEToSICommandConnector::ReceiveMessage(Connector *from, ConnectorMessage &m) { - UmbilicalConnected = false; + // + // Sanity check. + // + + if (m.destination != type) + { + return false; + } + + SIESEMessageType messageType; + + messageType = (SIESEMessageType)m.messageType; + + switch (messageType) + { + case SI_SIESE_GET_SI_THRUST_OK_SIMULATE: + if (ourSI_ESE) + { + m.val1.bValue = ourSI_ESE->GetSIThrustOKSimulate(m.val1.iValue, m.val2.iValue); + return true; + } + break; + } + + return false; +} + +bool SIESEToSICommandConnector::SIStageLogicCutoff() +{ + ConnectorMessage m; + + m.destination = SIESE_SI_COMMAND; + m.messageType = SIESE_SI_SI_STAGE_LOGIC_CUTOFF; + + if (SendMessage(m)) + { + return m.val1.bValue; + } + + return false; +} + +void SIESEToSICommandConnector::SetEngineStart(int eng) +{ + ConnectorMessage m; + + m.destination = SIESE_SI_COMMAND; + m.messageType = SIESE_SI_SET_ENGINE_START; + m.val1.iValue = eng; + + SendMessage(m); +} + +void SIESEToSICommandConnector::SIGSECutoff(bool cut) +{ + ConnectorMessage m; + + m.destination = SIESE_SI_COMMAND; + m.messageType = SIESE_SI_GSE_CUTOFF; + m.val1.bValue = cut; + + SendMessage(m); } -bool TailUmbilical::ESEGetSIThrustOKSimulate(int eng, int n) +void SIESEToSICommandConnector::GetSIThrustOK(bool *ok, int n) { - return TailUmb->ESEGetSIThrustOKSimulate(eng, n); + ConnectorMessage m; + + m.destination = SIESE_SI_COMMAND; + m.messageType = SIESE_SI_THRUST_OK; + m.val1.pValue = ok; + + if (SendMessage(m)) + { + return; + } + + for (int i = 0; i < n; i++) + { + ok[i] = false; + } } \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilical.h b/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilical.h index 400d388091..a4d2e644d6 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilical.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilical.h @@ -24,27 +24,27 @@ See http://nassp.sourceforge.net/license/ for more details. #pragma once -class TailUmbilicalInterface; +#include "connector.h" -class TailUmbilical +class SI_ESE; + +//IU ESE to IU connector +class SIESEToSICommandConnector : public Connector { public: - TailUmbilical(TailUmbilicalInterface *ml); - virtual ~TailUmbilical(); - - virtual void Disconnect() = 0; + SIESEToSICommandConnector(); + ~SIESEToSICommandConnector(); - //Called by IU during a pad abort. Technically doesn't disconnect IU umbilical - virtual void AbortDisconnect(); + //S-I to S-I ESE + bool ReceiveMessage(Connector *from, ConnectorMessage &m); - //From SLV to ML - virtual bool ESEGetSIThrustOKSimulate(int eng, int n); + //S-I ESE to S-I + bool SIStageLogicCutoff(); + void SetEngineStart(int eng); + void SIGSECutoff(bool cut); + void GetSIThrustOK(bool *ok, int n); - //From ML to SLV - virtual bool SIStageLogicCutoff() = 0; - virtual void SetEngineStart(int eng) = 0; - virtual void SIGSECutoff(bool cut) = 0; + void SetSI_ESE(SI_ESE *si_ese) { ourSI_ESE = si_ese; }; protected: - bool UmbilicalConnected; - TailUmbilicalInterface* TailUmb; + SI_ESE *ourSI_ESE; }; \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilicalInterface.h b/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilicalInterface.h index ebe3baa03f..7f87f1cda8 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilicalInterface.h +++ b/Orbitersdk/samples/ProjectApollo/src_launch/TailUmbilicalInterface.h @@ -24,8 +24,11 @@ See http://nassp.sourceforge.net/license/ for more details. #pragma once -class TailUmbilicalInterface +enum SIESEMessageType { -public: - virtual bool ESEGetSIThrustOKSimulate(int eng, int n) = 0; + SI_SIESE_GET_SI_THRUST_OK_SIMULATE, + SIESE_SI_SI_STAGE_LOGIC_CUTOFF, + SIESE_SI_SET_ENGINE_START, + SIESE_SI_GSE_CUTOFF, + SIESE_SI_THRUST_OK, }; diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/FCC.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/FCC.cpp index 16c46f6f37..2caaffcccb 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/FCC.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/FCC.cpp @@ -192,16 +192,16 @@ void FCC1B::Timestep(double simdt) beta_y4c = beta_yc + beta_rc / pow(2, 0.5); beta_p4c = beta_pc + beta_rc / pow(2, 0.5); - iu->GetLVCommandConnector()->SetSIThrusterDir(0, beta_y1c, beta_p1c); - iu->GetLVCommandConnector()->SetSIThrusterDir(1, beta_y2c, beta_p2c); - iu->GetLVCommandConnector()->SetSIThrusterDir(2, beta_y3c, beta_p3c); - iu->GetLVCommandConnector()->SetSIThrusterDir(3, beta_y4c, beta_p4c); + iu->GetSIVBCommandConnector()->SetSIThrusterDir(0, beta_y1c, beta_p1c); + iu->GetSIVBCommandConnector()->SetSIThrusterDir(1, beta_y2c, beta_p2c); + iu->GetSIVBCommandConnector()->SetSIThrusterDir(2, beta_y3c, beta_p3c); + iu->GetSIVBCommandConnector()->SetSIThrusterDir(3, beta_y4c, beta_p4c); } else if (SIVBBurnMode == true) { //SIVB powered flight beta_p1c = beta_pc; //gimbal angles beta_y1c = beta_yc; - iu->GetLVCommandConnector()->SetSIVBThrusterDir(beta_y1c, beta_p1c); + iu->GetSIVBCommandConnector()->SetSIVBThrusterDir(beta_y1c, beta_p1c); eps_p = 0; //we want neither the APS pitch thrusters to fire eps_ymr = -(a_0r * AttitudeError.x * DEG) - (a_1r * AttRate.x * DEG); //nor the yaw thrusters eps_ypr = (a_0r * AttitudeError.x * DEG) + (a_1r * AttRate.x * DEG); @@ -217,57 +217,57 @@ void FCC1B::Timestep(double simdt) //APS thruster on/off control if (eps_p > 1) { //fire+pitch - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(1, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(1, true); //if (eps_p >= 1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(1, 1); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(1, (eps_p - 1) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(1, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(1, false); } if (eps_p < -1) { //fire-pitch - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(0, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(0, true); //if (eps_p <= -1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(0, 1); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(0, (-eps_p - 1) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(0, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(0, false); } if (eps_ymr > 1) { //fire+yaw-roll; - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(3, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(3, true); //if (eps_ymr >= 1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(3, 1); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(3, (eps_ymr - 1) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(3, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(3, false); } if (eps_ymr < -1) { //fire-yaw+roll; - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(5, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(5, true); //if (eps_ymr <= -1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(5, 1); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(5, (-eps_ymr - 1) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(5, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(5, false); } if (eps_ypr > 1) { //fire+yaw+roll; - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(4, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(4, true); //if (eps_ypr >= 1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(4, 1); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(4, (eps_ypr - 1) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(4, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(4, false); } if (eps_ypr < -1) { //fire-yaw-roll; - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(2, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(2, true); //if (eps_ypr <= -1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(2, 1); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(2, (-eps_ypr - 1) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(2, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(2, false); } } } @@ -425,24 +425,24 @@ void FCCSV::Timestep(double simdt) beta_y4c = beta_yc + beta_rc / pow(2, 0.5); if (SIBurnMode) { //SIC - iu->GetLVCommandConnector()->SetSIThrusterDir(0, beta_y1c + (UseSICEngineCant ? SICCant : 0.0), beta_p1c - (UseSICEngineCant ? SICCant : 0.0)); - iu->GetLVCommandConnector()->SetSIThrusterDir(1, beta_y2c + (UseSICEngineCant ? SICCant : 0.0), beta_p2c + (UseSICEngineCant ? SICCant : 0.0)); - iu->GetLVCommandConnector()->SetSIThrusterDir(2, beta_y3c - (UseSICEngineCant ? SICCant : 0.0), beta_p3c + (UseSICEngineCant ? SICCant : 0.0)); - iu->GetLVCommandConnector()->SetSIThrusterDir(3, beta_y4c - (UseSICEngineCant ? SICCant : 0.0), beta_p4c - (UseSICEngineCant ? SICCant : 0.0)); + iu->GetSIVBCommandConnector()->SetSIThrusterDir(0, beta_y1c + (UseSICEngineCant ? SICCant : 0.0), beta_p1c - (UseSICEngineCant ? SICCant : 0.0)); + iu->GetSIVBCommandConnector()->SetSIThrusterDir(1, beta_y2c + (UseSICEngineCant ? SICCant : 0.0), beta_p2c + (UseSICEngineCant ? SICCant : 0.0)); + iu->GetSIVBCommandConnector()->SetSIThrusterDir(2, beta_y3c - (UseSICEngineCant ? SICCant : 0.0), beta_p3c + (UseSICEngineCant ? SICCant : 0.0)); + iu->GetSIVBCommandConnector()->SetSIThrusterDir(3, beta_y4c - (UseSICEngineCant ? SICCant : 0.0), beta_p4c - (UseSICEngineCant ? SICCant : 0.0)); } else { //These are all different - iu->GetLVCommandConnector()->SetSIIThrusterDir(2, beta_y2c, beta_p2c); - iu->GetLVCommandConnector()->SetSIIThrusterDir(0, beta_y4c, beta_p4c); - iu->GetLVCommandConnector()->SetSIIThrusterDir(3, beta_y1c, beta_p1c); - iu->GetLVCommandConnector()->SetSIIThrusterDir(1, beta_y3c, beta_p3c); + iu->GetSIVBCommandConnector()->SetSIIThrusterDir(2, beta_y2c, beta_p2c); + iu->GetSIVBCommandConnector()->SetSIIThrusterDir(0, beta_y4c, beta_p4c); + iu->GetSIVBCommandConnector()->SetSIIThrusterDir(3, beta_y1c, beta_p1c); + iu->GetSIVBCommandConnector()->SetSIIThrusterDir(1, beta_y3c, beta_p3c); } } else if (SIVBBurnMode) { //SIVB powered flight beta_p1c = beta_pc; //gimbal angles beta_y1c = beta_yc; - iu->GetLVCommandConnector()->SetSIVBThrusterDir(beta_y1c, beta_p1c); + iu->GetSIVBCommandConnector()->SetSIVBThrusterDir(beta_y1c, beta_p1c); eps_p = 0; //we want neither the APS pitch thrusters to fire eps_ymr = -(a_0r * AttitudeError.x * DEG) - (a_1r * AttRate.x * DEG); //nor the yaw thrusters eps_ypr = (a_0r * AttitudeError.x * DEG) + (a_1r * AttRate.x * DEG); @@ -458,57 +458,57 @@ void FCCSV::Timestep(double simdt) //APS thruster on/off control if (eps_p > 1) { //fire+pitch - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(1, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(1, true); //if (eps_p >= 1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(1, 1.0); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(1, (eps_p - 1.0) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(1, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(1, false); } if (eps_p < -1) { //fire-pitch - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(0, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(0, true); //if (eps_p <= -1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(0, 1.0); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(0, (-eps_p - 1.0) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(0, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(0, false); } if (eps_ymr > 1) { //fire+yaw-roll; - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(3, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(3, true); //if (eps_ymr >= 1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(3, 1.0); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(3, (eps_ymr - 1.0) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(3, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(3, false); } if (eps_ymr < -1) { //fire-yaw+roll; - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(5, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(5, true); //if (eps_ymr <= -1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(5, 1.0); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(5, (-eps_ymr - 1.0) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(5, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(5, false); } if (eps_ypr > 1) { //fire+yaw+roll; - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(4, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(4, true); //if (eps_ypr >= 1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(4, 1.0); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(4, (eps_ypr - 1.0) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(4, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(4, false); } if (eps_ypr < -1) { //fire-yaw-roll; - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(2, true); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(2, true); //if (eps_ypr <= -1.6) { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(2, 1.0); } //else { iu->GetLVCommandConnector()->SetAPSAttitudeEngine(2, (-eps_ypr - 1.0) / 0.6); } } else { - iu->GetLVCommandConnector()->SetAPSAttitudeEngine(2, false); + iu->GetSIVBCommandConnector()->SetAPSAttitudeEngine(2, false); } } diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/IUAuxiliaryPowerDistributor.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/IUAuxiliaryPowerDistributor.cpp index 568a3c34d2..0659813037 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/IUAuxiliaryPowerDistributor.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/IUAuxiliaryPowerDistributor.cpp @@ -36,7 +36,7 @@ IUAuxiliaryPowerDistributor1::IUAuxiliaryPowerDistributor1(IU *iu) void IUAuxiliaryPowerDistributor1::Timestep(double simdt) { - if (CommandPowerTransfer && iu->IsUmbilicalConnected()) + if (CommandPowerTransfer && iu->GetIUToIUESECommandConnector()->IsUmbilicalConnected()) MotorSwitchLogic = true; else MotorSwitchLogic = false; @@ -54,7 +54,7 @@ IUAuxiliaryPowerDistributor2::IUAuxiliaryPowerDistributor2(IU *iu) void IUAuxiliaryPowerDistributor2::Timestep(double simdt) { - if (iu->ESEGetEDSPowerInhibit()) + if (iu->GetIUToIUESECommandConnector()->GetEDSPowerInhibit()) { EDSBus1PowerOff = true; EDSBus2PowerOff = true; diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/IUControlDistributor.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/IUControlDistributor.cpp index 4553487a08..d491540455 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/IUControlDistributor.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/IUControlDistributor.cpp @@ -56,12 +56,12 @@ IUControlDistributor::IUControlDistributor(IU *iu) void IUControlDistributor::Timestep(double simdt) { - if (iu->ESEGetCommandVehicleLiftoffIndicationInhibit()) + if (iu->GetIUToIUESECommandConnector()->GetCommandVehicleLiftoffIndicationInhibit()) GSECommandVehicleLiftoffIndicationInhibit = true; else GSECommandVehicleLiftoffIndicationInhibit = false; - if (iu->GetLVCommandConnector()->GetSIVBThrustOK() == false) + if (iu->GetSIVBCommandConnector()->GetSIVBThrustOK() == false) { SIVBThrustNotOK = true; SIVBEngineOutA = true; @@ -141,15 +141,15 @@ void IUControlDistributor::SwitchSelector(int stage, int channel) } else if (stage == SWITCH_SELECTOR_SI) { - iu->GetLVCommandConnector()->SISwitchSelector(channel); + iu->GetSIVBCommandConnector()->SISwitchSelector(channel); } else if (stage == SWITCH_SELECTOR_SII) { - iu->GetLVCommandConnector()->SIISwitchSelector(channel); + iu->GetSIVBCommandConnector()->SIISwitchSelector(channel); } else if (stage == SWITCH_SELECTOR_SIVB) { - iu->GetLVCommandConnector()->SIVBSwitchSelector(channel); + iu->GetSIVBCommandConnector()->SIVBSwitchSelector(channel); } } @@ -217,10 +217,10 @@ void IUControlDistributor1B::LoadState(FILEHANDLE scn, char *end_str) { bool IUControlDistributor1B::GetSIBurnMode() { + //GSE S-IC Burn Mode Substitute + if (iu->GetIUToIUESECommandConnector()->GetSIBurnModeSubstitute()) return true; //Normal S-I Burn Mode Logic - if (iu->GetLVCommandConnector()->GetStage() < LAUNCH_STAGE_SIVB && !GSECommandVehicleLiftoffIndicationInhibit) return true; - //GSE S-I Burn Mode Substitute - if (iu->GetLVCommandConnector()->GetStage() == PRELAUNCH_STAGE) return true; + if (iu->GetSIVBCommandConnector()->SIXSIVBNotSeparated() && !GSECommandVehicleLiftoffIndicationInhibit) return true; return false; } @@ -242,7 +242,7 @@ void IUControlDistributorSV::Timestep(double simdt) { IUControlDistributor::Timestep(simdt); - if (iu->ESEGetSICOutboardEnginesCantInhibit()) + if (iu->GetIUToIUESECommandConnector()->GetSICOutboardEnginesCantInhibit()) SICOutboardEnginesCantInhibit = true; else SICOutboardEnginesCantInhibit = false; @@ -286,16 +286,16 @@ void IUControlDistributorSV::LoadState(FILEHANDLE scn, char *end_str) { bool IUControlDistributorSV::GetSIBurnMode() { //GSE S-IC Burn Mode Substitute - if (iu->ESEGetSIBurnModeSubstitute()) return true; + if (iu->GetIUToIUESECommandConnector()->GetSIBurnModeSubstitute()) return true; //Normal S-IC Burn Mode Logic - if (iu->GetLVCommandConnector()->GetStage() < LAUNCH_STAGE_SIVB && !IsSIIBurnMode && !GSECommandVehicleLiftoffIndicationInhibit) return true; + if (iu->GetSIVBCommandConnector()->SIXSIVBNotSeparated() && !IsSIIBurnMode && !GSECommandVehicleLiftoffIndicationInhibit) return true; return false; } bool IUControlDistributorSV::GetSIIBurnMode() { - if (iu->GetLVCommandConnector()->GetStage() < LAUNCH_STAGE_SIVB && IsSIIBurnMode && !GSECommandVehicleLiftoffIndicationInhibit) + if (iu->GetSIVBCommandConnector()->SIXSIVBNotSeparated() && IsSIIBurnMode && !GSECommandVehicleLiftoffIndicationInhibit) return true; return false; @@ -303,13 +303,13 @@ bool IUControlDistributorSV::GetSIIBurnMode() bool IUControlDistributorSV::UseSICEngineCant() { - if (iu->GetLVCommandConnector()->GetStage() < LAUNCH_STAGE_TWO && SICEngineCantC && !SICOutboardEnginesCantInhibit) + if (iu->GetSIVBCommandConnector()->SICSIINotSeparated() && SICEngineCantC && !SICOutboardEnginesCantInhibit) { if (SICEngineCantA) return true; else if (SICEngineCantB) return true; } else if (SICEngineCantA && SICEngineCantB && !SICOutboardEnginesCantInhibit) return true; - else if (iu->ESEGetSICOutboardEnginesCantSimulate()) return true; + else if (iu->GetIUToIUESECommandConnector()->GetSICOutboardEnginesCantSimulate()) return true; return false; } diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/LVDA.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/LVDA.cpp index ea1c467350..05d2072d57 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/LVDA.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/LVDA.cpp @@ -220,7 +220,7 @@ bool LVDA::GetLiftoff() bool LVDA::GetGuidanceReferenceRelease() { - return iu->ESEGetGuidanceReferenceRelease(); + return iu->GetIUToIUESECommandConnector()->GetGuidanceReferenceRelease(); } bool LVDA::GetSIVBO2H2BurnerMalfunction() diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/Saturn1b.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/Saturn1b.cpp index 55759ef5d5..088bf9293e 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/Saturn1b.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/Saturn1b.cpp @@ -293,67 +293,6 @@ void Saturn1b::clbkPostStep (double simt, double simdt, double mjd) { Saturn::clbkPostStep(simt, simdt, mjd); } -void Saturn1b::SISwitchSelector(int channel) -{ - if (stage > LAUNCH_STAGE_ONE) return; - - sib->SwitchSelector(channel); -} - -void Saturn1b::GetSIThrustOK(bool *ok) -{ - for (int i = 0;i < 24;i++) - { - ok[i] = false; - } - - if (stage > LAUNCH_STAGE_ONE) return; - - sib->GetThrustOK(ok); -} - -void Saturn1b::SIEDSCutoff(bool cut) -{ - if (stage > LAUNCH_STAGE_ONE) return; - - sib->EDSEnginesCutoff(cut); -} - -bool Saturn1b::GetSIPropellantDepletionEngineCutoff() -{ - if (stage > LAUNCH_STAGE_ONE) return false; - - return sib->GetOutboardEnginesCutoff(); -} - -bool Saturn1b::GetSIInboardEngineOut() -{ - if (stage > LAUNCH_STAGE_ONE) return false; - - return sib->GetInboardEngineOut(); -} - -bool Saturn1b::GetSIOutboardEngineOut() -{ - if (stage > LAUNCH_STAGE_ONE) return false; - - return sib->GetOutboardEngineOut(); -} - -bool Saturn1b::GetSIBLowLevelSensorsDry() -{ - if (stage > LAUNCH_STAGE_ONE) return false; - - return sib->GetLowLevelSensorsDry(); -} - -void Saturn1b::SetSIThrusterDir(int n, double yaw, double pitch) -{ - if (stage > LAUNCH_STAGE_ONE) return; - - sib->SetThrusterDir(n, yaw, pitch); -} - double Saturn1b::GetSIThrustLevel() { if (stage > LAUNCH_STAGE_ONE) return 0.0; @@ -469,6 +408,7 @@ void Saturn1b::CheckSaturnSystemsState() { Saturn::CheckSaturnSystemsState(); + //S-IB if (stage > LAUNCH_STAGE_ONE) { if (sib) @@ -477,6 +417,10 @@ void Saturn1b::CheckSaturnSystemsState() sib = 0; } } + else + { + sib->GetSIBtoSIVBConnector()->ConnectTo(sivb->GetSIVBSIXConnector()); + } } void Saturn1b::ConfigureStageMeshes(int stage_state) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/Saturn5.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/Saturn5.cpp index dfebe19c7a..6a6c9b7c43 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/Saturn5.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/Saturn5.cpp @@ -100,6 +100,7 @@ SaturnV::SaturnV (OBJHANDLE hObj, int fmodel) : Saturn (hObj, fmodel), hMaster = hObj; sic = NULL; sii = NULL; + sii_is = NULL; initSaturnV(); } @@ -212,6 +213,11 @@ SaturnV::~SaturnV() delete sii; sii = 0; } + if (sii_is) + { + delete sii_is; + sii_is = 0; + } } void SaturnV::CalculateStageMass () @@ -634,6 +640,10 @@ void SaturnV::CreateStageSpecificSystems() { sic = new SICSystems(this, th_1st, ph_1st, SICSIISepPyros, LaunchS, SShutS, contrailLevel); } + if (stage <= LAUNCH_STAGE_TWO) + { + sii_is = new SIIInterstageSystems(); + } if (stage <= LAUNCH_STAGE_TWO_ISTG_JET) { sii = new SIISystems(this, th_2nd, ph_2nd, thg_ull, SIIInterstagePyros, SIISIVBSepPyros, SPUShiftS, SepS); @@ -657,6 +667,22 @@ void SaturnV::CheckSaturnSystemsState() sic = 0; } } + else + { + sic->GetSICToSIIConnector()->ConnectTo(sii_is->GetSIIInterstageToSICConnector()); + } + if (stage > LAUNCH_STAGE_TWO) + { + if (sii_is) + { + delete sii_is; + sii_is = 0; + } + } + else + { + sii_is->GetSIIInterstageToSIIConnector()->ConnectTo(sii->GetSIIToSIIInterstageConnector()); + } if (stage > LAUNCH_STAGE_TWO_ISTG_JET) { if (sii) @@ -665,6 +691,10 @@ void SaturnV::CheckSaturnSystemsState() sii = 0; } } + else + { + sii->GetSIIToSIVBConnector()->ConnectTo(sivb->GetSIVBSIXConnector()); + } } void SaturnV::LoadIU(FILEHANDLE scn) @@ -912,108 +942,6 @@ void SaturnV::LaunchVehicleUnbuild() { } } -void SaturnV::SISwitchSelector(int channel) -{ - if (stage > LAUNCH_STAGE_ONE) return; - - sic->SwitchSelector(channel); -} - -void SaturnV::SIISwitchSelector(int channel) -{ - if (stage > LAUNCH_STAGE_TWO_ISTG_JET) return; - - sii->SwitchSelector(channel); -} - -void SaturnV::GetSIThrustOK(bool *ok) -{ - for (int i = 0;i < 15;i++) - { - ok[i] = false; - } - - if (stage > LAUNCH_STAGE_ONE) return; - - sic->GetThrustOK(ok); -} - -bool SaturnV::GetSIPropellantDepletionEngineCutoff() -{ - if (stage > LAUNCH_STAGE_ONE) return false; - - return sic->GetPropellantDepletionEngineCutoff(); -} - -bool SaturnV::GetSIInboardEngineOut() -{ - if (stage > LAUNCH_STAGE_ONE) return false; - - return sic->GetInboardEngineOut(); -} - -bool SaturnV::GetSIOutboardEngineOut() -{ - if (stage > LAUNCH_STAGE_ONE) return false; - - return sic->GetOutboardEngineOut(); -} - -void SaturnV::SetSIThrusterDir(int n, double yaw, double pitch) -{ - if (stage > LAUNCH_STAGE_ONE) return; - - sic->SetThrusterDir(n, yaw, pitch); -} - -bool SaturnV::GetSIIPropellantDepletionEngineCutoff() -{ - if (stage != LAUNCH_STAGE_TWO && stage != LAUNCH_STAGE_TWO_ISTG_JET) return false; - - return sii->GetPropellantDepletionEngineCutoff(); -} - -void SaturnV::SIEDSCutoff(bool cut) -{ - if (stage > LAUNCH_STAGE_ONE) return; - - sic->EDSEnginesCutoff(cut); -} - -void SaturnV::GetSIIThrustOK(bool *ok) -{ - for (int i = 0;i < 5;i++) - { - ok[i] = false; - } - - if (stage != LAUNCH_STAGE_TWO && stage != LAUNCH_STAGE_TWO_ISTG_JET) return; - - sii->GetThrustOK(ok); -} - -void SaturnV::SetSIIThrusterDir(int n, double yaw, double pitch) -{ - if (stage != LAUNCH_STAGE_TWO && stage != LAUNCH_STAGE_TWO_ISTG_JET) return; - - sii->SetThrusterDir(n, yaw, pitch); -} - -void SaturnV::SIIEDSCutoff(bool cut) -{ - if (stage != LAUNCH_STAGE_TWO && stage != LAUNCH_STAGE_TWO_ISTG_JET) return; - - sii->EDSEnginesCutoff(cut); -} - -double SaturnV::GetSIIFuelTankPressurePSI() -{ - if (stage <= LAUNCH_STAGE_TWO_ISTG_JET) - return sii->GetLH2TankUllagePressurePSI(); - - return 0.0; -} - void SaturnV::SaveSII(FILEHANDLE scn) { sii->SaveState(scn); diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/eds.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/eds.cpp index f003d7c0fc..ed9f329105 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/eds.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/eds.cpp @@ -91,8 +91,8 @@ EDS::EDS(IU *iu) ExcessiveRollRateIndication = false; ExcessivePitchYawRateIndicationA = false; ExcessivePitchYawRateIndicationB = false; - SIAllEnginesOKA = false; - SIAllEnginesOKB = false; + SINotAllEnginesOKA = false; + SINotAllEnginesOKB = false; AutoAbort1AToSC = false; AutoAbort1BToSC = false; AutoAbort2AToSC = false; @@ -111,7 +111,6 @@ EDS::EDS(IU *iu) LVRateAutoSwitchOff = false; TwoEngineOutAutoSwitchOff = false; - Stage = 0; EDSBus1Powered = false; EDSBus2Powered = false; EDSBus3Powered = false; @@ -128,43 +127,43 @@ void EDS::Timestep(double simdt) else IUEDSBusPowered = false; - if (iu->ESEGetCommandVehicleLiftoffIndicationInhibit()) + if (iu->GetIUToIUESECommandConnector()->GetCommandVehicleLiftoffIndicationInhibit()) LiftoffRelay = true; else LiftoffRelay = false; - if (iu->ESEPadAbortRequest()) + if (iu->GetIUToIUESECommandConnector()->PadAbortRequest()) PadAbortRequest = true; else PadAbortRequest = false; - if (iu->ESEGetEngineThrustIndicationEnableInhibitA()) + if (iu->GetIUToIUESECommandConnector()->GetEngineThrustIndicationEnableInhibitA()) GSEEngineThrustIndicationEnableA = true; else GSEEngineThrustIndicationEnableA = false; - if (iu->ESEGetEngineThrustIndicationEnableInhibitB()) + if (iu->GetIUToIUESECommandConnector()->GetEngineThrustIndicationEnableInhibitB()) GSEEngineThrustIndicationEnableB = true; else GSEEngineThrustIndicationEnableB = false; - if (iu->ESEEDSLiftoffInhibitA()) + if (iu->GetIUToIUESECommandConnector()->EDSLiftoffInhibitA()) EDSLiftoffInhibitA = true; else EDSLiftoffInhibitA = false; - if (iu->ESEEDSLiftoffInhibitB()) + if (iu->GetIUToIUESECommandConnector()->EDSLiftoffInhibitB()) EDSLiftoffInhibitB = true; else EDSLiftoffInhibitB = false; //S-IVB Thrust Monitor - if (IUEDSBusPowered && SIVBEngineOutIndicationA && iu->GetLVCommandConnector()->GetSIVBThrustOK() == false) + if (IUEDSBusPowered && SIVBEngineOutIndicationA && iu->GetSIVBCommandConnector()->GetSIVBThrustOK() == false) SIVBEngineThrustMonitorA = true; else SIVBEngineThrustMonitorA = false; - if (IUEDSBusPowered && SIVBEngineOutIndicationB && iu->GetLVCommandConnector()->GetSIVBThrustOK() == false) + if (IUEDSBusPowered && SIVBEngineOutIndicationB && iu->GetSIVBCommandConnector()->GetSIVBThrustOK() == false) SIVBEngineThrustMonitorB = true; else SIVBEngineThrustMonitorB = false; @@ -172,7 +171,6 @@ void EDS::Timestep(double simdt) //Input signals LVRateAutoSwitchOff = iu->GetCommandConnector()->LVRateAutoSwitchState() == TOGGLESWITCH_DOWN; TwoEngineOutAutoSwitchOff = iu->GetCommandConnector()->TwoEngineOutAutoSwitchState() == TOGGLESWITCH_DOWN; - Stage = iu->GetLVCommandConnector()->GetStage(); EDSBus1Powered = iu->GetCommandConnector()->IsEDSBusPowered(1); EDSBus2Powered = iu->GetCommandConnector()->IsEDSBusPowered(2); EDSBus3Powered = iu->GetCommandConnector()->IsEDSBusPowered(3); @@ -182,50 +180,50 @@ void EDS::Timestep(double simdt) //Auto Abort Relays //Two-Engines Out tempsignal1 = iu->GetControlDistributor()->GetTwoEnginesOutAutoAbortInhibit() || (IUEDSBusPowered && TwoEngineOutAutoSwitchOff); - if (iu->ESEGetTwoEngineOutAutoAbortInhibit(1) || tempsignal1) + if (iu->GetIUToIUESECommandConnector()->GetTwoEngineOutAutoAbortInhibit(1) || tempsignal1) TwoEngineOutAutoAbortInhibitNo1 = true; else TwoEngineOutAutoAbortInhibitNo1 = false; - if (iu->ESEGetTwoEngineOutAutoAbortInhibit(2) || tempsignal1) + if (iu->GetIUToIUESECommandConnector()->GetTwoEngineOutAutoAbortInhibit(2) || tempsignal1) TwoEngineOutAutoAbortInhibitNo2 = true; else TwoEngineOutAutoAbortInhibitNo2 = false; - if (iu->ESEGetTwoEngineOutAutoAbortInhibit(3) || tempsignal1) + if (iu->GetIUToIUESECommandConnector()->GetTwoEngineOutAutoAbortInhibit(3) || tempsignal1) TwoEngineOutAutoAbortInhibitNo3 = true; else TwoEngineOutAutoAbortInhibitNo3 = false; //Excessive Rate tempsignal1 = iu->GetControlDistributor()->GetExcessiveRatePYRAutoAbortInhibit() || (IUEDSBusPowered && LVRateAutoSwitchOff); - if (iu->ESEGetExcessivePitchYawRateAutoAbortInhibit(1) || tempsignal1) + if (iu->GetIUToIUESECommandConnector()->GetExcessivePitchYawRateAutoAbortInhibit(1) || tempsignal1) ExcessiveRateAutoAbortInhibitPY1 = true; else ExcessiveRateAutoAbortInhibitPY1 = false; - if (iu->ESEGetExcessivePitchYawRateAutoAbortInhibit(2) || tempsignal1) + if (iu->GetIUToIUESECommandConnector()->GetExcessivePitchYawRateAutoAbortInhibit(2) || tempsignal1) ExcessiveRateAutoAbortInhibitPY2 = true; else ExcessiveRateAutoAbortInhibitPY2 = false; - if (iu->ESEGetExcessivePitchYawRateAutoAbortInhibit(3) || tempsignal1) + if (iu->GetIUToIUESECommandConnector()->GetExcessivePitchYawRateAutoAbortInhibit(3) || tempsignal1) ExcessiveRateAutoAbortInhibitPY3 = true; else ExcessiveRateAutoAbortInhibitPY3 = false; tempsignal1 = iu->GetControlDistributor()->GetExcessiveRatePYRAutoAbortInhibit() || iu->GetControlDistributor()->GetExcessiveRateRollAutoAbortInhibit() || (IUEDSBusPowered && LVRateAutoSwitchOff); - if (iu->ESEGetExcessiveRollRateAutoAbortInhibit(1) || tempsignal1) + if (iu->GetIUToIUESECommandConnector()->GetExcessiveRollRateAutoAbortInhibit(1) || tempsignal1) ExcessiveRateAutoAbortInhibitR1 = true; else ExcessiveRateAutoAbortInhibitR1 = false; - if (iu->ESEGetExcessiveRollRateAutoAbortInhibit(2) || tempsignal1) + if (iu->GetIUToIUESECommandConnector()->GetExcessiveRollRateAutoAbortInhibit(2) || tempsignal1) ExcessiveRateAutoAbortInhibitR2 = true; else ExcessiveRateAutoAbortInhibitR2 = false; - if (iu->ESEGetExcessiveRollRateAutoAbortInhibit(3) || tempsignal1) + if (iu->GetIUToIUESECommandConnector()->GetExcessiveRollRateAutoAbortInhibit(3) || tempsignal1) ExcessiveRateAutoAbortInhibitR3 = true; else ExcessiveRateAutoAbortInhibitR3 = false; @@ -237,17 +235,17 @@ void EDS::Timestep(double simdt) } //LV Engines EDS Cutoff Inhibit - if ((IUEDSBusPowered && !BECOA) || iu->ESEGetEDSLVCutoffSimulate(1)) + if ((IUEDSBusPowered && !BECOA) || iu->GetIUToIUESECommandConnector()->GetEDSLVCutoffSimulate(1)) LVEnginesCutoffFromSC1 = true; else LVEnginesCutoffFromSC1 = false; - if ((IUEDSBusPowered && (!BECOA || !BECOB)) || iu->ESEGetEDSLVCutoffSimulate(2)) + if ((IUEDSBusPowered && (!BECOA || !BECOB)) || iu->GetIUToIUESECommandConnector()->GetEDSLVCutoffSimulate(2)) LVEnginesCutoffFromSC2 = true; else LVEnginesCutoffFromSC2 = false; - if ((IUEDSBusPowered && !BECOB) || iu->ESEGetEDSLVCutoffSimulate(3)) + if ((IUEDSBusPowered && !BECOB) || iu->GetIUToIUESECommandConnector()->GetEDSLVCutoffSimulate(3)) LVEnginesCutoffFromSC3 = true; else LVEnginesCutoffFromSC3 = false; @@ -270,19 +268,19 @@ void EDS::Timestep(double simdt) //Overrate Auto Abort //Roll - if (iu->ESEGetGSEOverrateSimulate(3) || IUEDSBusPowered && iu->GetContSigProc()->GetRollNo3Overrate()) + if (iu->GetIUToIUESECommandConnector()->GetGSEOverrateSimulate(3) || IUEDSBusPowered && iu->GetContSigProc()->GetRollNo3Overrate()) ExcessiveRollRateVotingA = true; else ExcessiveRollRateVotingA = false; - tempsignal1 = iu->ESEGetGSEOverrateSimulate(2) || IUEDSBusPowered && iu->GetContSigProc()->GetRollNo2Overrate(); + tempsignal1 = iu->GetIUToIUESECommandConnector()->GetGSEOverrateSimulate(2) || IUEDSBusPowered && iu->GetContSigProc()->GetRollNo2Overrate(); if (tempsignal1) ExcessiveRollRateVotingB = true; else ExcessiveRollRateVotingB = false; - tempsignal2 = iu->ESEGetGSEOverrateSimulate(1) || IUEDSBusPowered && iu->GetContSigProc()->GetRollNo1Overrate(); + tempsignal2 = iu->GetIUToIUESECommandConnector()->GetGSEOverrateSimulate(1) || IUEDSBusPowered && iu->GetContSigProc()->GetRollNo1Overrate(); if ((tempsignal1 && ExcessiveRollRateVotingA) || (tempsignal2 && ExcessiveRollRateVotingB)) ExcessiveRollRateIndication = true; @@ -290,19 +288,19 @@ void EDS::Timestep(double simdt) ExcessiveRollRateIndication = false; //Pitch - if (iu->ESEGetGSEOverrateSimulate(6) || IUEDSBusPowered && iu->GetContSigProc()->GetPitchNo3Overrate()) + if (iu->GetIUToIUESECommandConnector()->GetGSEOverrateSimulate(6) || IUEDSBusPowered && iu->GetContSigProc()->GetPitchNo3Overrate()) ExcessivePitchRateVotingA = true; else ExcessivePitchRateVotingA = false; - tempsignal1 = iu->ESEGetGSEOverrateSimulate(5) || IUEDSBusPowered && iu->GetContSigProc()->GetPitchNo2Overrate(); + tempsignal1 = iu->GetIUToIUESECommandConnector()->GetGSEOverrateSimulate(5) || IUEDSBusPowered && iu->GetContSigProc()->GetPitchNo2Overrate(); if (tempsignal1) ExcessivePitchRateVotingB = true; else ExcessivePitchRateVotingB = false; - tempsignal2 = iu->ESEGetGSEOverrateSimulate(4) || IUEDSBusPowered && iu->GetContSigProc()->GetPitchNo1Overrate(); + tempsignal2 = iu->GetIUToIUESECommandConnector()->GetGSEOverrateSimulate(4) || IUEDSBusPowered && iu->GetContSigProc()->GetPitchNo1Overrate(); if ((tempsignal1 && ExcessivePitchRateVotingA) || (tempsignal2 && ExcessivePitchRateVotingB)) ExcessivePitchYawRateIndicationA = true; @@ -310,19 +308,19 @@ void EDS::Timestep(double simdt) ExcessivePitchYawRateIndicationA = false; //Yaw - if (iu->ESEGetGSEOverrateSimulate(9) || IUEDSBusPowered && iu->GetContSigProc()->GetYawNo3Overrate()) + if (iu->GetIUToIUESECommandConnector()->GetGSEOverrateSimulate(9) || IUEDSBusPowered && iu->GetContSigProc()->GetYawNo3Overrate()) ExcessiveYawRateVotingA = true; else ExcessiveYawRateVotingA = false; - tempsignal1 = iu->ESEGetGSEOverrateSimulate(8) || IUEDSBusPowered && iu->GetContSigProc()->GetYawNo2Overrate(); + tempsignal1 = iu->GetIUToIUESECommandConnector()->GetGSEOverrateSimulate(8) || IUEDSBusPowered && iu->GetContSigProc()->GetYawNo2Overrate(); if (tempsignal1) ExcessiveYawRateVotingB = true; else ExcessiveYawRateVotingB = false; - tempsignal2 = iu->ESEGetGSEOverrateSimulate(7) || IUEDSBusPowered && iu->GetContSigProc()->GetYawNo1Overrate(); + tempsignal2 = iu->GetIUToIUESECommandConnector()->GetGSEOverrateSimulate(7) || IUEDSBusPowered && iu->GetContSigProc()->GetYawNo1Overrate(); if ((tempsignal1 && ExcessiveYawRateVotingA) || (tempsignal2 && ExcessiveYawRateVotingB)) ExcessivePitchYawRateIndicationB = true; @@ -395,7 +393,7 @@ void EDS::Timestep(double simdt) } //Guidance Reference Release - if (iu->ESEGetGuidanceReferenceRelease()) + if (iu->GetIUToIUESECommandConnector()->GetGuidanceReferenceRelease()) iu->GetCommandConnector()->SetAGCInputChannelBit(030, GuidanceReferenceRelease, true); else iu->GetCommandConnector()->SetAGCInputChannelBit(030, GuidanceReferenceRelease, false); @@ -409,32 +407,32 @@ void EDS::Timestep(double simdt) void EDS::AutoAbortCircuits() { - if (AutoAbortBus || iu->ESEGetEDSAutoAbortSimulate(1)) + if (AutoAbortBus || iu->GetIUToIUESECommandConnector()->GetEDSAutoAbortSimulate(1)) AutoAbort1AToSC = true; else AutoAbort1AToSC = false; - if (AutoAbortBus || iu->ESEGetEDSAutoAbortSimulate(2)) + if (AutoAbortBus || iu->GetIUToIUESECommandConnector()->GetEDSAutoAbortSimulate(2)) AutoAbort1BToSC = true; else AutoAbort1BToSC = false; - if (AutoAbortBus || iu->ESEGetEDSAutoAbortSimulate(3)) + if (AutoAbortBus || iu->GetIUToIUESECommandConnector()->GetEDSAutoAbortSimulate(3)) AutoAbort2AToSC = true; else AutoAbort2AToSC = false; - if (AutoAbortBus || iu->ESEGetEDSAutoAbortSimulate(4)) + if (AutoAbortBus || iu->GetIUToIUESECommandConnector()->GetEDSAutoAbortSimulate(4)) AutoAbort2BToSC = true; else AutoAbort2BToSC = false; - if (AutoAbortBus || iu->ESEGetEDSAutoAbortSimulate(5)) + if (AutoAbortBus || iu->GetIUToIUESECommandConnector()->GetEDSAutoAbortSimulate(5)) AutoAbort3AToSC = true; else AutoAbort3AToSC = false; - if (AutoAbortBus || iu->ESEGetEDSAutoAbortSimulate(6)) + if (AutoAbortBus || iu->GetIUToIUESECommandConnector()->GetEDSAutoAbortSimulate(6)) AutoAbort3BToSC = true; else AutoAbort3BToSC = false; @@ -495,22 +493,22 @@ double EDS::GetLVTankPressure(int n) //S-IVB LOX No. 1 Tank Pressure if (n == 1) { - return iu->GetLVCommandConnector()->GetSIVBLOXTankPressurePSI(); + return iu->GetSIVBCommandConnector()->GetSIVBLOXTankPressurePSI(); } //S-IVB LOX No. 2 Tank Pressure else if (n == 2) { - return iu->GetLVCommandConnector()->GetSIVBLOXTankPressurePSI(); + return iu->GetSIVBCommandConnector()->GetSIVBLOXTankPressurePSI(); } //S-IVB Fuel No. 1 Tank Pressure else if (n == 3) { - return iu->GetLVCommandConnector()->GetSIVBFuelTankPressurePSI(); + return iu->GetSIVBCommandConnector()->GetSIVBFuelTankPressurePSI(); } //S-IVB Fuel No. 2 Tank Pressure else if (n == 4) { - return iu->GetLVCommandConnector()->GetSIVBFuelTankPressurePSI(); + return iu->GetSIVBCommandConnector()->GetSIVBFuelTankPressurePSI(); } return 0.0; @@ -523,7 +521,7 @@ bool EDS::GetSCControl() bool EDS::GetAllSIEnginesRunning() { - return (!SIAllEnginesOKA && !SIAllEnginesOKB); + return (!SINotAllEnginesOKA && !SINotAllEnginesOKB); } bool EDS::IsEDSUnsafeA() @@ -536,6 +534,16 @@ bool EDS::IsEDSUnsafeB() return iu->GetCommandConnector()->IsEDSUnsafeB(); } +void EDS::GetAutoAbortToSC(bool *abort) +{ + abort[0] = AutoAbort1AToSC; + abort[1] = AutoAbort1BToSC; + abort[2] = AutoAbort2AToSC; + abort[3] = AutoAbort2BToSC; + abort[4] = AutoAbort3AToSC; + abort[5] = AutoAbort3BToSC; +} + void EDS::ResetBus1() { LVEnginesCutoffEnable1 = false; @@ -631,26 +639,23 @@ EDS1B::EDS1B(IU *iu) : EDS(iu) void EDS1B::Timestep(double simdt) { - if (iu->GetLVCommandConnector() == NULL) return; - if (iu->GetCommandConnector() == NULL) return; - EDS::Timestep(simdt); - SIAllEnginesOKA = false; - SIAllEnginesOKB = false; + SINotAllEnginesOKA = false; + SINotAllEnginesOKB = false; //S-IB Thrust Monitor - if (IUEDSBusPowered && Stage <= LAUNCH_STAGE_ONE) + if (IUEDSBusPowered && iu->GetSIVBCommandConnector()->SIXSIVBNotSeparated()) { - iu->GetLVCommandConnector()->GetSIThrustOK(ThrustOKSignal, 24); + iu->GetSIVBCommandConnector()->GetSIThrustOK(ThrustOKSignal, 24); for (int i = 0;i < 8;i++) { SIThrustNotOK[i] = TripleVoting(!ThrustOKSignal[3 * i], !ThrustOKSignal[3 * i + 1], !ThrustOKSignal[3 * i + 2]); if (SIThrustNotOK[i]) { - SIAllEnginesOKA = true; - SIAllEnginesOKB = true; + SINotAllEnginesOKA = true; + SINotAllEnginesOKB = true; } } } @@ -665,33 +670,27 @@ void EDS1B::Timestep(double simdt) //EDS Engine Cutoff if (LVEnginesCutoffCommand1 || LVEnginesCutoffCommand3) { - if (Stage == LAUNCH_STAGE_ONE) + if (!SIEDSCutoff) { - if (!SIEDSCutoff) - { - SIEDSCutoff = true; - iu->GetLVCommandConnector()->SIEDSCutoff(true); - } + SIEDSCutoff = true; + iu->GetSIVBCommandConnector()->SIEDSCutoff(true); } - else if (Stage == LAUNCH_STAGE_SIVB || Stage == STAGE_ORBIT_SIVB) + if (!SIVBEngineCutoffDisabled && !SIVBEDSCutoff) { - if (!SIVBEngineCutoffDisabled && !SIVBEDSCutoff) - { - SIVBEDSCutoff = true; - iu->GetLVCommandConnector()->SIVBEDSCutoff(true); - } + SIVBEDSCutoff = true; + iu->GetSIVBCommandConnector()->SIVBEDSCutoff(true); } } else { if (SIEDSCutoff == true) { - iu->GetLVCommandConnector()->SIEDSCutoff(false); + iu->GetSIVBCommandConnector()->SIEDSCutoff(false); SIEDSCutoff = false; } if (SIVBEDSCutoff == true) { - iu->GetLVCommandConnector()->SIVBEDSCutoff(false); + iu->GetSIVBCommandConnector()->SIVBEDSCutoff(false); SIVBEDSCutoff = false; } } @@ -792,12 +791,12 @@ double EDSSV::GetLVTankPressure(int n) if (SIISIVBNotSeparated) { //S-II LH2 Tank Ullage Pressure No. 1 - return iu->GetLVCommandConnector()->GetSIIFuelTankPressurePSI(); + return iu->GetSIVBCommandConnector()->GetSIIFuelTankPressurePSI(); } else { //S-IVB LOX No. 1 Tank Pressure - return iu->GetLVCommandConnector()->GetSIVBLOXTankPressurePSI(); + return iu->GetSIVBCommandConnector()->GetSIVBLOXTankPressurePSI(); } } else if (n == 2) @@ -805,23 +804,23 @@ double EDSSV::GetLVTankPressure(int n) if (SIISIVBNotSeparated) { //S-II LH2 Tank Ullage Pressure No. 2 - return iu->GetLVCommandConnector()->GetSIIFuelTankPressurePSI(); + return iu->GetSIVBCommandConnector()->GetSIIFuelTankPressurePSI(); } else { //S-IVB LOX No. 2 Tank Pressure - return iu->GetLVCommandConnector()->GetSIVBLOXTankPressurePSI(); + return iu->GetSIVBCommandConnector()->GetSIVBLOXTankPressurePSI(); } } //S-IVB Fuel No. 1 Tank Pressure else if (n == 3) { - return iu->GetLVCommandConnector()->GetSIVBFuelTankPressurePSI(); + return iu->GetSIVBCommandConnector()->GetSIVBFuelTankPressurePSI(); } //S-IVB Fuel No. 2 Tank Pressure else if (n == 4) { - return iu->GetLVCommandConnector()->GetSIVBFuelTankPressurePSI(); + return iu->GetSIVBCommandConnector()->GetSIVBFuelTankPressurePSI(); } return 0.0; @@ -829,31 +828,28 @@ double EDSSV::GetLVTankPressure(int n) void EDSSV::Timestep(double simdt) { - if (iu->GetLVCommandConnector() == NULL) return; - if (iu->GetCommandConnector() == NULL) return; - EDS::Timestep(simdt); - if (Stage < LAUNCH_STAGE_SIVB) + if (iu->GetSIVBCommandConnector()->SIXSIVBNotSeparated()) SIISIVBNotSeparated = true; else SIISIVBNotSeparated = false; - SIAllEnginesOKA = false; - SIAllEnginesOKB = false; + SINotAllEnginesOKA = false; + SINotAllEnginesOKB = false; //S-IC Thrust Monitor - if (IUEDSBusPowered && Stage <= LAUNCH_STAGE_ONE) + if (IUEDSBusPowered && iu->GetSIVBCommandConnector()->SICSIINotSeparated()) { - iu->GetLVCommandConnector()->GetSIThrustOK(ThrustOKSignal, 15); + iu->GetSIVBCommandConnector()->GetSIThrustOK(ThrustOKSignal, 15); for (int i = 0;i < 5;i++) { SIThrustNotOK[i] = TripleVoting(!ThrustOKSignal[3 * i], !ThrustOKSignal[3 * i + 1], !ThrustOKSignal[3 * i + 2]); if (SIThrustNotOK[i]) { - SIAllEnginesOKA = true; - SIAllEnginesOKB = true; + SINotAllEnginesOKA = true; + SINotAllEnginesOKB = true; } } } @@ -866,10 +862,10 @@ void EDSSV::Timestep(double simdt) } //S-II Thrust Monitor - if (IUEDSBusPowered && (Stage == LAUNCH_STAGE_TWO || Stage == LAUNCH_STAGE_TWO_ISTG_JET)) + if (IUEDSBusPowered && (SIIEngineOutIndicationA || SIIEngineOutIndicationB) && iu->GetSIVBCommandConnector()->SIXSIVBNotSeparated()) { - iu->GetLVCommandConnector()->GetSIIThrustOK(ThrustOKSignal); - for (int i = 0;i < 5;i++) + iu->GetSIVBCommandConnector()->GetSIIThrustOK(ThrustOKSignal); + for (int i = 0; i < 5; i++) { SIIEngineThrustMonitorA[i] = SIIEngineOutIndicationA && !ThrustOKSignal[i]; SIIEngineThrustMonitorB[i] = SIIEngineOutIndicationB && !ThrustOKSignal[i]; @@ -877,7 +873,7 @@ void EDSSV::Timestep(double simdt) } else { - for (int i = 0;i < 5;i++) + for (int i = 0; i < 5; i++) { SIIEngineThrustMonitorA[i] = false; SIIEngineThrustMonitorB[i] = false; @@ -887,46 +883,37 @@ void EDSSV::Timestep(double simdt) //EDS Engine Cutoff if (LVEnginesCutoffCommand1 || LVEnginesCutoffCommand3) { - if (Stage == LAUNCH_STAGE_ONE) + if (!SIEDSCutoff) { - if (!SIEDSCutoff) - { - SIEDSCutoff = true; - iu->GetLVCommandConnector()->SIEDSCutoff(true); - } + SIEDSCutoff = true; + iu->GetSIVBCommandConnector()->SIEDSCutoff(true); } - else if (Stage == LAUNCH_STAGE_TWO || Stage == LAUNCH_STAGE_TWO_ISTG_JET) + if (!SIIEDSCutoff) { - if (!SIIEDSCutoff) - { - SIIEDSCutoff = true; - iu->GetLVCommandConnector()->SIIEDSCutoff(true); - } + SIIEDSCutoff = true; + iu->GetSIVBCommandConnector()->SIIEDSCutoff(true); } - else if (Stage == LAUNCH_STAGE_SIVB || Stage == STAGE_ORBIT_SIVB) + if (!SIVBEngineCutoffDisabled && !SIVBEDSCutoff) { - if (!SIVBEngineCutoffDisabled && !SIVBEDSCutoff) - { - SIVBEDSCutoff = true; - iu->GetLVCommandConnector()->SIVBEDSCutoff(true); - } + SIVBEDSCutoff = true; + iu->GetSIVBCommandConnector()->SIVBEDSCutoff(true); } } else { if (SIEDSCutoff == true) { - iu->GetLVCommandConnector()->SIEDSCutoff(false); + iu->GetSIVBCommandConnector()->SIEDSCutoff(false); SIEDSCutoff = false; } if (SIIEDSCutoff == true) { - iu->GetLVCommandConnector()->SIIEDSCutoff(false); + iu->GetSIVBCommandConnector()->SIIEDSCutoff(false); SIIEDSCutoff = false; } if (SIVBEDSCutoff == true) { - iu->GetLVCommandConnector()->SIVBEDSCutoff(false); + iu->GetSIVBCommandConnector()->SIVBEDSCutoff(false); SIVBEDSCutoff = false; } } @@ -965,8 +952,8 @@ void EDSSV::Timestep(double simdt) } //Second Plane Separation Monitor - bool SIISecPlaneSepA = EDSBus1Powered && SIIEngineOutIndicationA && (SIVBRestartAlert || Stage < LAUNCH_STAGE_TWO_ISTG_JET); - bool SIISecPlaneSepB = EDSBus3Powered && SIIEngineOutIndicationB && (SIVBRestartAlert || Stage < LAUNCH_STAGE_TWO_ISTG_JET); + bool SIISecPlaneSepA = EDSBus1Powered && SIIEngineOutIndicationA && (SIVBRestartAlert || iu->GetSIVBCommandConnector()->SIIInterstageNotSeparated()); + bool SIISecPlaneSepB = EDSBus3Powered && SIIEngineOutIndicationB && (SIVBRestartAlert || iu->GetSIVBCommandConnector()->SIIInterstageNotSeparated()); if (SIISecPlaneSepA || SIISecPlaneSepB) iu->GetCommandConnector()->SetSIISep(); diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/eds.h b/Orbitersdk/samples/ProjectApollo/src_saturn/eds.h index 6110e88ec4..72e2eba10a 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/eds.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/eds.h @@ -84,6 +84,9 @@ class EDS bool GetLVEnginesCutoffFromSC3() { return LVEnginesCutoffFromSC3; } bool GetExcessiveRollRateIndication() { return ExcessiveRollRateIndication; } bool GetExcessivePitchYawRateIndication() { return (ExcessivePitchYawRateIndicationA || ExcessivePitchYawRateIndicationB); } + bool GetSCCutoffEnabledA() { return LVEnginesCutoffEnable1; } + bool GetSCCutoffEnabledB() { return LVEnginesCutoffEnable2; } + void GetAutoAbortToSC(bool *abort); void SetEDSLiftoffEnableA() { EDSLiftoffEnableA = true; } void SetEDSLiftoffEnableB() { EDSLiftoffEnableB = true; } @@ -202,9 +205,9 @@ class EDS //A9K5(K222) bool ExcessivePitchYawRateIndicationB; //A9K3 (K59) - bool SIAllEnginesOKA; + bool SINotAllEnginesOKA; //A4K4 (K219) - bool SIAllEnginesOKB; + bool SINotAllEnginesOKB; //A4K1 bool SCControlEnableRelay; //A4K6 (K291-1), A10K3 (K291-2) @@ -226,7 +229,6 @@ class EDS bool AbortLightSignal; bool LVRateAutoSwitchOff; bool TwoEngineOutAutoSwitchOff; - int Stage; bool EDSBus1Powered, EDSBus2Powered, EDSBus3Powered; bool BECOA, BECOB; diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/iu.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/iu.cpp index 8b8ec82985..93254b4bca 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/iu.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/iu.cpp @@ -35,6 +35,7 @@ #include "saturn.h" #include "papi.h" #include "IUUmbilical.h" +#include "IUUmbilicalInterface.h" #include "iu.h" @@ -53,16 +54,16 @@ ControlSignalProcessor(this) SCControlPoweredFlight = false; commandConnector.SetIU(this); - - IuUmb = NULL; + sivbCommandConnector.SetIU(this); + iuToIUESECommandConnector.SetIU(this); } IU::~IU() { - if (IuUmb) - { - IuUmb->AbortDisconnect(); - } + commandConnector.Disconnect(); + lvCommandConnector.Disconnect(); + sivbCommandConnector.Disconnect(); + iuToIUESECommandConnector.Disconnect(); } void IU::SetMissionInfo(bool crewed, bool sccontpowered) @@ -77,7 +78,7 @@ void IU::Timestep(double simt, double simdt, double mjd) AuxiliaryPowerDistributor2.Timestep(simdt); //Set the launch stage here - if (!IsUmbilicalConnected() && lvCommandConnector.GetStage() == PRELAUNCH_STAGE) + if (!iuToIUESECommandConnector.IsUmbilicalConnected() && lvCommandConnector.GetStage() == PRELAUNCH_STAGE) { lvCommandConnector.SetStage(LAUNCH_STAGE_ONE); } @@ -159,30 +160,33 @@ void IU::LoadState(FILEHANDLE scn) } void IU::ConnectToCSM(Connector *csmConnector) - { commandConnector.ConnectTo(csmConnector); } void IU::ConnectToLV(Connector *CommandConnector) - { lvCommandConnector.ConnectTo(CommandConnector); } +void IU::ConnectToSIVB(Connector *CommandConnector) +{ + sivbCommandConnector.ConnectTo(CommandConnector); +} + bool IU::GetSIPropellantDepletionEngineCutoff() { - return lvCommandConnector.GetSIPropellantDepletionEngineCutoff(); + return sivbCommandConnector.GetSIPropellantDepletionEngineCutoff(); } bool IU::GetSIInboardEngineOut() { - return lvCommandConnector.GetSIInboardEngineOut(); + return sivbCommandConnector.GetSIInboardEngineOut(); } bool IU::GetSIOutboardEngineOut() { - return lvCommandConnector.GetSIOutboardEngineOut(); + return sivbCommandConnector.GetSIOutboardEngineOut(); } bool IU::SIBLowLevelSensorsDry() @@ -251,146 +255,27 @@ bool IU::DCSUplink(int type, void *upl) return dcs.Uplink(type, upl); } -bool IU::IsUmbilicalConnected() -{ - if (IuUmb && IuUmb->IsIUUmbilicalConnected()) return true; - - return false; -} - -void IU::ConnectUmbilical(IUUmbilical *umb) -{ - IuUmb = umb; -} - -void IU::DisconnectUmbilical() -{ - IuUmb = NULL; -} - void IU::DisconnectIU() { lvCommandConnector.Disconnect(); commandConnector.Disconnect(); + sivbCommandConnector.Disconnect(); } -bool IU::ESEGetCommandVehicleLiftoffIndicationInhibit() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetCommandVehicleLiftoffIndicationInhibit(); -} - -bool IU::ESEGetExcessiveRollRateAutoAbortInhibit(int n) -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetExcessiveRollRateAutoAbortInhibit(n); -} - -bool IU::ESEGetExcessivePitchYawRateAutoAbortInhibit(int n) -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetExcessivePitchYawRateAutoAbortInhibit(n); -} - -bool IU::ESEGetTwoEngineOutAutoAbortInhibit(int n) -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetTwoEngineOutAutoAbortInhibit(n); -} - -bool IU::ESEGetGSEOverrateSimulate(int n) -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetGSEOverrateSimulate(n); -} - -bool IU::ESEGetEDSPowerInhibit() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetEDSPowerInhibit(); -} - -bool IU::ESEPadAbortRequest() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEPadAbortRequest(); -} - -bool IU::ESEGetEngineThrustIndicationEnableInhibitA() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetThrustOKIndicateEnableInhibitA(); -} - -bool IU::ESEGetEngineThrustIndicationEnableInhibitB() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetThrustOKIndicateEnableInhibitB(); -} - -bool IU::ESEEDSLiftoffInhibitA() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEEDSLiftoffInhibitA(); -} - -bool IU::ESEEDSLiftoffInhibitB() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEEDSLiftoffInhibitB(); -} - -bool IU::ESEGetSIBurnModeSubstitute() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetSIBurnModeSubstitute(); -} - -bool IU::ESEGetGuidanceReferenceRelease() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetGuidanceReferenceRelease(); -} - -bool IU::ESEESEGetQBallSimulateCmd() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetQBallSimulateCmd(); -} - -bool IU::ESEGetEDSAutoAbortSimulate(int n) +IUConnector::IUConnector() { - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetEDSAutoAbortSimulate(n); + ourIU = 0; } -bool IU::ESEGetEDSLVCutoffSimulate(int n) +IUConnector::~IUConnector() { - if (!IsUmbilicalConnected()) return false; - return IuUmb->ESEGetEDSLVCutoffSimulate(n); } IUToCSMCommandConnector::IUToCSMCommandConnector() { type = CSM_IU_COMMAND; - ourIU = 0; } IUToCSMCommandConnector::~IUToCSMCommandConnector() @@ -849,7 +734,7 @@ bool IUToCSMCommandConnector::ReceiveMessage(Connector *from, ConnectorMessage & case CSMIU_GET_QBALL_SIMULATE_CMD: if (ourIU) { - m.val1.bValue = ourIU->ESEESEGetQBallSimulateCmd(); + m.val1.bValue = ourIU->GetIUToIUESECommandConnector()->GetQBallSimulateCmd(); return true; } break; @@ -858,68 +743,67 @@ bool IUToCSMCommandConnector::ReceiveMessage(Connector *from, ConnectorMessage & return false; } -IUToLVCommandConnector::IUToLVCommandConnector() - +IUToSIVBCommandConnector::IUToSIVBCommandConnector() { - type = LV_IU_COMMAND; + type = SIVB_IU_COMMAND; } -IUToLVCommandConnector::~IUToLVCommandConnector() - +IUToSIVBCommandConnector::~IUToSIVBCommandConnector() { + } -void IUToLVCommandConnector::SetAPSAttitudeEngine(int n, bool on) +void IUToSIVBCommandConnector::SetAPSAttitudeEngine(int n, bool on) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SET_APS_ATTITUDE_ENGINE; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_SET_APS_ATTITUDE_ENGINE; cm.val1.iValue = n; cm.val2.bValue = on; SendMessage(cm); } -void IUToLVCommandConnector::SIEDSCutoff(bool cut) +void IUToSIVBCommandConnector::SIEDSCutoff(bool cut) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SI_EDS_CUTOFF; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_SI_EDS_CUTOFF; cm.val1.bValue = cut; SendMessage(cm); } -void IUToLVCommandConnector::SIIEDSCutoff(bool cut) +void IUToSIVBCommandConnector::SIIEDSCutoff(bool cut) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SII_EDS_CUTOFF; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_SII_EDS_CUTOFF; cm.val1.bValue = cut; SendMessage(cm); } -void IUToLVCommandConnector::SIVBEDSCutoff(bool cut) +void IUToSIVBCommandConnector::SIVBEDSCutoff(bool cut) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SIVB_EDS_CUTOFF; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_SIVB_EDS_CUTOFF; cm.val1.bValue = cut; SendMessage(cm); } -void IUToLVCommandConnector::SetSIThrusterDir(int n, double yaw, double pitch) +void IUToSIVBCommandConnector::SetSIThrusterDir(int n, double yaw, double pitch) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SET_SI_THRUSTER_DIR; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_SET_SI_THRUSTER_DIR; cm.val1.iValue = n; cm.val2.dValue = yaw; cm.val3.dValue = pitch; @@ -927,12 +811,12 @@ void IUToLVCommandConnector::SetSIThrusterDir(int n, double yaw, double pitch) SendMessage(cm); } -void IUToLVCommandConnector::SetSIIThrusterDir(int n, double yaw, double pitch) +void IUToSIVBCommandConnector::SetSIIThrusterDir(int n, double yaw, double pitch) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SET_SII_THRUSTER_DIR; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_SET_SII_THRUSTER_DIR; cm.val1.iValue = n; cm.val2.dValue = yaw; cm.val3.dValue = pitch; @@ -940,250 +824,178 @@ void IUToLVCommandConnector::SetSIIThrusterDir(int n, double yaw, double pitch) SendMessage(cm); } -void IUToLVCommandConnector::SetSIVBThrusterDir(double yaw, double pitch) +void IUToSIVBCommandConnector::SetSIVBThrusterDir(double yaw, double pitch) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SET_SIVB_THRUSTER_DIR; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_SET_SIVB_THRUSTER_DIR; cm.val1.dValue = yaw; cm.val2.dValue = pitch; SendMessage(cm); } -void IUToLVCommandConnector::SISwitchSelector(int channel) +void IUToSIVBCommandConnector::SISwitchSelector(int channel) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SI_SWITCH_SELECTOR; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_SI_SWITCH_SELECTOR; cm.val1.iValue = channel; SendMessage(cm); } -void IUToLVCommandConnector::SIISwitchSelector(int channel) +void IUToSIVBCommandConnector::SIISwitchSelector(int channel) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SII_SWITCH_SELECTOR; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_SII_SWITCH_SELECTOR; cm.val1.iValue = channel; SendMessage(cm); } -void IUToLVCommandConnector::SIVBSwitchSelector(int channel) +void IUToSIVBCommandConnector::SIVBSwitchSelector(int channel) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SIVB_SWITCH_SELECTOR; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_SIVB_SWITCH_SELECTOR; cm.val1.iValue = channel; SendMessage(cm); } -void IUToLVCommandConnector::SeparateStage(int stage) -{ - ConnectorMessage cm; - - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SEPARATE_STAGE; - cm.val1.iValue = stage; - - SendMessage(cm); -} - -void IUToLVCommandConnector::SetStage(int stage) +void IUToSIVBCommandConnector::GetSIThrustOK(bool *ok, int n) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_SET_STAGE; - cm.val1.iValue = stage; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SI_THRUST_OK; + cm.val1.pValue = ok; + cm.val2.iValue = n; - SendMessage(cm); + (SendMessage(cm)); } -void IUToLVCommandConnector::JettisonNosecap() +void IUToSIVBCommandConnector::GetSIIThrustOK(bool *ok) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_NOSECAP_JETTISON; - - SendMessage(cm); -} - -void IUToLVCommandConnector::DeploySLAPanel() -{ - ConnectorMessage cm; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SII_THRUST_OK; + cm.val1.pValue = ok; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_DEPLOY_SLA_PANEL; + if (SendMessage(cm)) + { + return; + } - SendMessage(cm); + for (int i = 0; i < 5; i++) + { + ok[i] = false; + } } -double IUToLVCommandConnector::GetMass() - +bool IUToSIVBCommandConnector::GetSIVBThrustOK() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_MASS; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SIVB_THRUST_OK; if (SendMessage(cm)) { - return cm.val1.dValue; + return cm.val1.bValue; } - return 0.0; + return false; } -int IUToLVCommandConnector::GetStage() - +bool IUToSIVBCommandConnector::GetSIPropellantDepletionEngineCutoff() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_STAGE; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF; if (SendMessage(cm)) { - return cm.val1.iValue; + return cm.val1.bValue; } - return NULL_STAGE; -} - -void IUToLVCommandConnector::GetGlobalOrientation(VECTOR3 &arot) - -{ - ConnectorMessage cm; - - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_GLOBAL_ORIENTATION; - cm.val1.pValue = &arot; - - SendMessage(cm); + return false; } -OBJHANDLE IUToLVCommandConnector::GetGravityRef() - +bool IUToSIVBCommandConnector::GetSIIPropellantDepletionEngineCutoff() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_GRAVITY_REF; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SII_PROPELLANT_DEPLETION_ENGINE_CUTOFF; if (SendMessage(cm)) { - return cm.val1.hValue; + return cm.val1.bValue; } - return 0; -} - -void IUToLVCommandConnector::GetRelativePos(OBJHANDLE ref, VECTOR3 &v) - -{ - ConnectorMessage cm; - - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_RELATIVE_POS; - cm.val1.hValue = ref; - cm.val2.pValue = &v; - - SendMessage(cm); + return false; } -void IUToLVCommandConnector::GetRelativeVel(OBJHANDLE ref, VECTOR3 &v) - +bool IUToSIVBCommandConnector::GetSIBLowLevelSensorsDry() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_RELATIVE_VEL; - cm.val1.hValue = ref; - cm.val2.pValue = &v; - - SendMessage(cm); -} - -void IUToLVCommandConnector::GetGlobalVel(VECTOR3 &v) - -{ - ConnectorMessage cm; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SIB_LOW_LEVEL_SENSORS_DRY; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_GLOBAL_VEL; - cm.val1.pValue = &v; + if (SendMessage(cm)) + { + return cm.val1.bValue; + } - SendMessage(cm); + return false; } -bool IUToLVCommandConnector::GetWeightVector(VECTOR3 &w) - +bool IUToSIVBCommandConnector::GetSIInboardEngineOut() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_WEIGHTVECTOR; - cm.val1.pValue = &w; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SI_INBOARD_ENGINE_OUT; if (SendMessage(cm)) - { - return cm.val2.bValue; + { + return cm.val1.bValue; } return false; } -void IUToLVCommandConnector::GetInertialAccel(VECTOR3 &a) - -{ - ConnectorMessage cm; - - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_INERTIAL_ACCEL; - cm.val1.pValue = &a; - - SendMessage(cm); -} - -void IUToLVCommandConnector::GetRotationMatrix(MATRIX3 &rot) - +bool IUToSIVBCommandConnector::GetSIOutboardEngineOut() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_ROTATIONMATRIX; - cm.val1.pValue = &rot; - - SendMessage(cm); -} - -void IUToLVCommandConnector::GetAngularVel(VECTOR3 &avel) - -{ - ConnectorMessage cm; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SI_OUTBOARD_ENGINE_OUT; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_ANGULARVEL; - cm.val1.pValue = &avel; + if (SendMessage(cm)) + { + return cm.val1.bValue; + } - SendMessage(cm); + return false; } -double IUToLVCommandConnector::GetMissionTime() +double IUToSIVBCommandConnector::GetSIIFuelTankPressurePSI() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_MISSIONTIME; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SII_FUEL_TANK_PRESSURE; if (SendMessage(cm)) { @@ -1193,39 +1005,42 @@ double IUToLVCommandConnector::GetMissionTime() return 0.0; } -int IUToLVCommandConnector::GetVehicleNo() +double IUToSIVBCommandConnector::GetSIVBLOXTankPressurePSI() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_VEHICLENO; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SIVB_LOX_TANK_PRESSURE; if (SendMessage(cm)) { - return cm.val1.iValue; + return cm.val1.dValue; } - return 0; + return 0.0; } -void IUToLVCommandConnector::GetSIThrustOK(bool *ok, int n) +double IUToSIVBCommandConnector::GetSIVBFuelTankPressurePSI() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_SI_THRUST_OK; - cm.val1.pValue = ok; - cm.val2.iValue = n; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SIVB_FUEL_TANK_PRESSURE; - (SendMessage(cm)); + if (SendMessage(cm)) + { + return cm.val1.dValue; + } + + return 0.0; } -bool IUToLVCommandConnector::GetSIPropellantDepletionEngineCutoff() +bool IUToSIVBCommandConnector::SIXSIVBNotSeparated() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SIX_SIVB_NOT_SEPARATED; if (SendMessage(cm)) { @@ -1235,12 +1050,12 @@ bool IUToLVCommandConnector::GetSIPropellantDepletionEngineCutoff() return false; } -bool IUToLVCommandConnector::GetSIInboardEngineOut() +bool IUToSIVBCommandConnector::SICSIINotSeparated() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_SI_INBOARD_ENGINE_OUT; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SIC_SII_NOT_SEPARATED; if (SendMessage(cm)) { @@ -1250,12 +1065,12 @@ bool IUToLVCommandConnector::GetSIInboardEngineOut() return false; } -bool IUToLVCommandConnector::GetSIOutboardEngineOut() +bool IUToSIVBCommandConnector::SIIInterstageNotSeparated() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_SI_OUTBOARD_ENGINE_OUT; + cm.destination = SIVB_IU_COMMAND; + cm.messageType = IUSIVB_GET_SII_INTERSTAGE_NOT_SEPARATED; if (SendMessage(cm)) { @@ -1265,127 +1080,635 @@ bool IUToLVCommandConnector::GetSIOutboardEngineOut() return false; } -bool IUToLVCommandConnector::GetSIBLowLevelSensorsDry() +IUToLVCommandConnector::IUToLVCommandConnector() +{ + type = LV_IU_COMMAND; +} + +IUToLVCommandConnector::~IUToLVCommandConnector() +{ +} + +void IUToLVCommandConnector::SeparateStage(int stage) +{ + ConnectorMessage cm; + + cm.destination = LV_IU_COMMAND; + cm.messageType = IULV_SEPARATE_STAGE; + cm.val1.iValue = stage; + + SendMessage(cm); +} + +void IUToLVCommandConnector::SetStage(int stage) +{ + ConnectorMessage cm; + + cm.destination = LV_IU_COMMAND; + cm.messageType = IULV_SET_STAGE; + cm.val1.iValue = stage; + + SendMessage(cm); +} + +void IUToLVCommandConnector::JettisonNosecap() +{ + ConnectorMessage cm; + + cm.destination = LV_IU_COMMAND; + cm.messageType = IULV_NOSECAP_JETTISON; + + SendMessage(cm); +} + +void IUToLVCommandConnector::DeploySLAPanel() +{ + ConnectorMessage cm; + + cm.destination = LV_IU_COMMAND; + cm.messageType = IULV_DEPLOY_SLA_PANEL; + + SendMessage(cm); +} + +int IUToLVCommandConnector::GetStage() + +{ + ConnectorMessage cm; + + cm.destination = LV_IU_COMMAND; + cm.messageType = IULV_GET_STAGE; + + if (SendMessage(cm)) + { + return cm.val1.iValue; + } + + return NULL_STAGE; +} + +void IUToLVCommandConnector::GetRelativePos(OBJHANDLE ref, VECTOR3 &v) + +{ + ConnectorMessage cm; + + cm.destination = LV_IU_COMMAND; + cm.messageType = IULV_GET_RELATIVE_POS; + cm.val1.hValue = ref; + cm.val2.pValue = &v; + + SendMessage(cm); +} + +void IUToLVCommandConnector::GetRelativeVel(OBJHANDLE ref, VECTOR3 &v) + +{ + ConnectorMessage cm; + + cm.destination = LV_IU_COMMAND; + cm.messageType = IULV_GET_RELATIVE_VEL; + cm.val1.hValue = ref; + cm.val2.pValue = &v; + + SendMessage(cm); +} + +void IUToLVCommandConnector::GetInertialAccel(VECTOR3 &a) + +{ + ConnectorMessage cm; + + cm.destination = LV_IU_COMMAND; + cm.messageType = IULV_GET_INERTIAL_ACCEL; + cm.val1.pValue = &a; + + SendMessage(cm); +} + +void IUToLVCommandConnector::GetRotationMatrix(MATRIX3 &rot) + +{ + ConnectorMessage cm; + + cm.destination = LV_IU_COMMAND; + cm.messageType = IULV_GET_ROTATIONMATRIX; + cm.val1.pValue = &rot; + + SendMessage(cm); +} + +void IUToLVCommandConnector::GetAngularVel(VECTOR3 &avel) + { ConnectorMessage cm; cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_SIB_LOW_LEVEL_SENSORS_DRY; + cm.messageType = IULV_GET_ANGULARVEL; + cm.val1.pValue = &avel; + + SendMessage(cm); +} + +int IUToLVCommandConnector::GetVehicleNo() +{ + ConnectorMessage cm; + + cm.destination = LV_IU_COMMAND; + cm.messageType = IULV_GET_VEHICLENO; + + if (SendMessage(cm)) + { + return cm.val1.iValue; + } + + return 0; +} + +bool IUToLVCommandConnector::CSMSeparationSensed() +{ + ConnectorMessage cm; + + cm.destination = LV_IU_COMMAND; + cm.messageType = IULV_CSM_SEPARATION_SENSED; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +IUToIUESECommandConnector::IUToIUESECommandConnector() +{ + type = IUESE_IU_COMMAND; +} + +IUToIUESECommandConnector::~IUToIUESECommandConnector() +{ + +} + +bool IUToIUESECommandConnector::ReceiveMessage(Connector *from, ConnectorMessage &m) +{ + // +// Sanity check. +// + + if (m.destination != type) + { + return false; + } + + IUESEMessageType messageType; + + messageType = (IUESEMessageType)m.messageType; + + switch (messageType) + { + case IUESE_IU_SET_EDS_LIFTOFF_ENABLE_A: + if (ourIU) + { + ourIU->GetEDS()->SetEDSLiftoffEnableA(); + return true; + } + break; + case IUESE_IU_SET_EDS_LIFTOFF_ENABLE_B: + if (ourIU) + { + ourIU->GetEDS()->SetEDSLiftoffEnableB(); + return true; + } + break; + case IUESE_IU_EDS_LIFTOFF_ENABLE_RESET: + if (ourIU) + { + ourIU->GetEDS()->LiftoffEnableReset(); + return true; + } + break; + case IUESE_IU_SET_FCC_POWER: + if (ourIU) + { + ourIU->GetControlDistributor()->SetFCCPower(m.val1.bValue); + return true; + } + break; + case IUESE_IU_SET_Q_BALL_POWER: + if (ourIU) + { + ourIU->GetControlDistributor()->SetQBallPower(m.val1.bValue); + return true; + } + break; + case IUESE_IU_SET_CONTROL_SIGNAL_PROCESSOR_POWER: + if (ourIU) + { + ourIU->GetControlDistributor()->SetControlSignalProcessorPowerOn(m.val1.bValue); + return true; + } + break; + case IUESE_IU_EDS_GROUP_NO_1_RESET: + if (ourIU) + { + ourIU->GetControlDistributor()->ResetBus1(); + return true; + } + break; + case IUESE_IU_EDS_GROUP_NO_2_RESET: + if (ourIU) + { + ourIU->GetControlDistributor()->ResetBus2(); + return true; + } + break; + case IUESE_IU_ALL_SI_ENGINES_RUNNING: + if (ourIU) + { + m.val1.bValue = ourIU->GetEDS()->GetAllSIEnginesRunning(); + return true; + } + break; + case IUESE_IU_IS_EDS_UNSAFE_A: + if (ourIU) + { + m.val1.bValue = ourIU->GetEDS()->IsEDSUnsafeA(); + return true; + } + break; + case IUESE_IU_IS_EDS_UNSAFE_B: + if (ourIU) + { + m.val1.bValue = ourIU->GetEDS()->IsEDSUnsafeB(); + return true; + } + break; + case IUESE_IU_GET_EDS_SC_CUTOFF: + if (ourIU) + { + if (m.val1.iValue == 1) + { + m.val1.bValue = ourIU->GetEDS()->GetLVEnginesCutoffFromSC1(); + } + else if (m.val1.iValue == 2) + { + m.val1.bValue = ourIU->GetEDS()->GetLVEnginesCutoffFromSC2(); + } + else + { + m.val1.bValue = ourIU->GetEDS()->GetLVEnginesCutoffFromSC3(); + } + return true; + } + break; + case IUESE_IU_GET_EDS_AUTO_ABORT_BUS: + if (ourIU) + { + m.val1.bValue = ourIU->GetEDS()->GetAutoAbort(); + return true; + } + break; + case IUESE_IU_GET_EDS_EXCESSIVE_ROLL_RATE_INDICATION: + if (ourIU) + { + m.val1.bValue = ourIU->GetEDS()->GetExcessiveRollRateIndication(); + return true; + } + break; + case IUESE_IU_GET_EDS_EXCESSIVE_PITCH_YAW_RATE_INDICATION: + if (ourIU) + { + m.val1.bValue = ourIU->GetEDS()->GetExcessivePitchYawRateIndication(); + return true; + } + break; + case IUESE_IU_GET_LVDC_OUTPUT_REGISTER_DISCRETE: + if (ourIU) + { + m.val1.bValue = ourIU->GetLVDA()->GetOutputRegisterBit(m.val1.iValue); + return true; + } + break; + case IUESE_IU_FCC_POWER_IS_ON: + if (ourIU) + { + m.val1.bValue = ourIU->GetControlDistributor()->GetFCCPowerOn(); + return true; + } + break; + case IUESE_IU_SWITCH_SELECTOR: + if (ourIU) + { + ourIU->GetControlDistributor()->SwitchSelector(m.val1.iValue, m.val2.iValue); + return true; + } + break; + case IUESE_IU_LVDC_PREPARE_TO_LAUNCH: + if (ourIU) + { + ourIU->GetLVDA()->PrepareToLaunch(); + return true; + } + break; + case IUESE_IU_EDS_SC_CUTOFF_ENABLE_A: + if (ourIU) + { + ourIU->GetEDS()->GetSCCutoffEnabledA(); + return true; + } + break; + case IUESE_IU_EDS_SC_CUTOFF_ENABLE_B: + if (ourIU) + { + ourIU->GetEDS()->GetSCCutoffEnabledB(); + return true; + } + break; + case IUESE_IU_EDS_GET_LIFTOFF_ENABLE_A: + if (ourIU) + { + ourIU->GetEDS()->GetLiftoffEnableA(); + return true; + } + break; + case IUESE_IU_EDS_GET_LIFTOFF_ENABLE_B: + if (ourIU) + { + ourIU->GetEDS()->GetLiftoffEnableB(); + return true; + } + break; + case IUESE_IU_EDS_GET_ABORT_TO_SC: + if (ourIU) + { + ourIU->GetEDS()->GetAutoAbortToSC((bool*)m.val1.pValue); + return true; + } + break; + } + return false; +} + +bool IUToIUESECommandConnector::IsUmbilicalConnected() +{ + return (connectedTo != NULL); +} + +bool IUToIUESECommandConnector::GetCommandVehicleLiftoffIndicationInhibit() +{ + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_COMMAND_VEHICLE_LIFTOFF_INDICATION_INHIBIT; if (SendMessage(cm)) { return cm.val1.bValue; } + return false; +} + +bool IUToIUESECommandConnector::GetExcessiveRollRateAutoAbortInhibit(int n) +{ + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_EXCESSIVE_ROLL_RATE_AUTO_ABORT_INHIBIT; + cm.val1.iValue = n; + if (SendMessage(cm)) + { + return cm.val1.bValue; + } return false; } -void IUToLVCommandConnector::GetSIIThrustOK(bool *ok) +bool IUToIUESECommandConnector::GetExcessivePitchYawRateAutoAbortInhibit(int n) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_SII_THRUST_OK; - cm.val1.pValue = ok; + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_EXCESSIVE_PITCH_YAW_RATE_AUTO_ABORT_INHIBIT; + cm.val1.iValue = n; if (SendMessage(cm)) { - return; + return cm.val1.bValue; } + return false; +} + +bool IUToIUESECommandConnector::GetTwoEngineOutAutoAbortInhibit(int n) +{ + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_TWO_ENGINE_OUT_AUTO_ABORT_INHIBIT; + cm.val1.iValue = n; - for (int i = 0;i < 5;i++) + if (SendMessage(cm)) { - ok[i] = false; + return cm.val1.bValue; + } + return false; +} + +bool IUToIUESECommandConnector::GetGSEOverrateSimulate(int n) +{ + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_GSE_OVERRATE_SIMULATE; + cm.val1.iValue = n; + + if (SendMessage(cm)) + { + return cm.val1.bValue; } + return false; } -bool IUToLVCommandConnector::GetSIIPropellantDepletionEngineCutoff() +bool IUToIUESECommandConnector::GetEDSPowerInhibit() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_SII_PROPELLANT_DEPLETION_ENGINE_CUTOFF; + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_EDS_POWER_INHIBIT; if (SendMessage(cm)) { return cm.val1.bValue; } + return false; +} +bool IUToIUESECommandConnector::PadAbortRequest() +{ + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_PAD_ABORT_REQUEST; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } return false; } -bool IUToLVCommandConnector::GetSIVBThrustOK() +bool IUToIUESECommandConnector::GetEngineThrustIndicationEnableInhibitA() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_SIVB_THRUST_OK; + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_ENGINE_THRUST_INDICATION_ENABLE_INHIBIT_A; if (SendMessage(cm)) { return cm.val1.bValue; } + return false; +} + +bool IUToIUESECommandConnector::GetEngineThrustIndicationEnableInhibitB() +{ + ConnectorMessage cm; + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_ENGINE_THRUST_INDICATION_ENABLE_INHIBIT_B; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } return false; } -double IUToLVCommandConnector::GetSIIFuelTankPressurePSI() +bool IUToIUESECommandConnector::EDSLiftoffInhibitA() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_SII_FUEL_TANK_PRESSURE; + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_EDS_LIFTOFF_INHIBIT_A; if (SendMessage(cm)) { - return cm.val1.dValue; + return cm.val1.bValue; } + return false; +} - return 0.0; +bool IUToIUESECommandConnector::EDSLiftoffInhibitB() +{ + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_EDS_LIFTOFF_INHIBIT_B; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -double IUToLVCommandConnector::GetSIVBLOXTankPressurePSI() +bool IUToIUESECommandConnector::GetSIBurnModeSubstitute() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_SIVB_LOX_TANK_PRESSURE; + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_SI_BURN_MODE_SUBSTITUTE; if (SendMessage(cm)) { - return cm.val1.dValue; + return cm.val1.bValue; } + return false; +} - return 0.0; +bool IUToIUESECommandConnector::GetGuidanceReferenceRelease() +{ + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_GUIDANCE_REFERENCE_RELEASE; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -double IUToLVCommandConnector::GetSIVBFuelTankPressurePSI() +bool IUToIUESECommandConnector::GetQBallSimulateCmd() { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_GET_SIVB_FUEL_TANK_PRESSURE; + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_Q_BALL_SIMULATE_CMD; if (SendMessage(cm)) { - return cm.val1.dValue; + return cm.val1.bValue; } + return false; +} - return 0.0; +bool IUToIUESECommandConnector::GetEDSAutoAbortSimulate(int n) +{ + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_EDS_AUTO_ABORT_SIMULATE; + cm.val1.iValue = n; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; } -bool IUToLVCommandConnector::CSMSeparationSensed() +bool IUToIUESECommandConnector::GetEDSLVCutoffSimulate(int n) { ConnectorMessage cm; - cm.destination = LV_IU_COMMAND; - cm.messageType = IULV_CSM_SEPARATION_SENSED; + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_EDS_LV_CUTOFF_SIMULATE; + cm.val1.iValue = n; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + return false; +} + +bool IUToIUESECommandConnector::GetSICOutboardEnginesCantInhibit() +{ + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_SIC_OUTBOARD_ENGINES_CANT_INHIBIT; if (SendMessage(cm)) { return cm.val1.bValue; } + return false; +} + +bool IUToIUESECommandConnector::GetSICOutboardEnginesCantSimulate() +{ + ConnectorMessage cm; + + cm.destination = IUESE_IU_COMMAND; + cm.messageType = IU_IUESE_GET_SIC_OUTBOARD_ENGINES_CANT_SIMULATE; + if (SendMessage(cm)) + { + return cm.val1.bValue; + } return false; } @@ -1422,7 +1745,7 @@ void IU1B::Timestep(double simt, double simdt, double mjd) bool IU1B::SIBLowLevelSensorsDry() { - return lvCommandConnector.GetSIBLowLevelSensorsDry(); + return sivbCommandConnector.GetSIBLowLevelSensorsDry(); } void IU1B::LoadLVDC(FILEHANDLE scn) { @@ -1578,7 +1901,7 @@ void IUSV::LoadLVDC(FILEHANDLE scn) { bool IUSV::GetSIIPropellantDepletionEngineCutoff() { - return lvCommandConnector.GetSIIPropellantDepletionEngineCutoff(); + return sivbCommandConnector.GetSIIPropellantDepletionEngineCutoff(); } bool IUSV::GetSIIEnginesOut() @@ -1596,20 +1919,6 @@ bool IUSV::GetSIIOutboardEngineOut() return eds.GetSIIOutboardEngineOut(); } -bool IUSV::ESEGetSICOutboardEnginesCantInhibit() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetSICOutboardEnginesCantInhibit(); -} - -bool IUSV::ESEGetSICOutboardEnginesCantSimulate() -{ - if (!IsUmbilicalConnected()) return false; - - return IuUmb->ESEGetSICOutboardEnginesCantSimulate(); -} - void IUSV::SwitchSelector(int item) { switch (item) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/iu.h b/Orbitersdk/samples/ProjectApollo/src_saturn/iu.h index 25e7f44a65..c1e5b15e2b 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/iu.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/iu.h @@ -39,7 +39,6 @@ class SoundLib; class IU; -class IUUmbilical; /// /// \ingroup Connectors @@ -86,53 +85,67 @@ enum IUCSMMessageType /// enum IULVMessageType { - IULV_SET_APS_ATTITUDE_ENGINE, - IULV_SI_EDS_CUTOFF, - IULV_SII_EDS_CUTOFF, - IULV_SIVB_EDS_CUTOFF, - IULV_SET_SI_THRUSTER_DIR, ///< Set thruster direction. - IULV_SET_SII_THRUSTER_DIR, - IULV_SET_SIVB_THRUSTER_DIR, - IULV_SI_SWITCH_SELECTOR, - IULV_SII_SWITCH_SELECTOR, - IULV_SIVB_SWITCH_SELECTOR, IULV_SEPARATE_STAGE, IULV_SET_STAGE, IULV_NOSECAP_JETTISON, IULV_DEPLOY_SLA_PANEL, IULV_GET_STAGE, ///< Get mission stage. - IULV_GET_GLOBAL_ORIENTATION, - IULV_GET_MASS, ///< Get the spacecraft mass. - IULV_GET_GRAVITY_REF, ///< Get gravity reference. IULV_GET_RELATIVE_POS, ///< Get relative position. IULV_GET_RELATIVE_VEL, ///< Get relative velocity. - IULV_GET_WEIGHTVECTOR, ///< Get weight vector IULV_GET_INERTIAL_ACCEL, ///< Get inertial acceleration IULV_GET_ROTATIONMATRIX, ///< Get rotation matrix - IULV_GET_GLOBAL_VEL, ///< Get global vel IULV_GET_ANGULARVEL, ///< Get angular velocity - IULV_GET_MISSIONTIME, - IULV_GET_SI_THRUST_OK, - IULV_GET_SII_THRUST_OK, - IULV_GET_SIVB_THRUST_OK, - IULV_GET_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF, - IULV_GET_SII_PROPELLANT_DEPLETION_ENGINE_CUTOFF, - IULV_GET_SI_INBOARD_ENGINE_OUT, - IULV_GET_SI_OUTBOARD_ENGINE_OUT, - IULV_GET_SIB_LOW_LEVEL_SENSORS_DRY, IULV_CSM_SEPARATION_SENSED, - IULV_GET_SII_FUEL_TANK_PRESSURE, - IULV_GET_SIVB_FUEL_TANK_PRESSURE, - IULV_GET_SIVB_LOX_TANK_PRESSURE, IULV_GET_VEHICLENO }; +enum IUSIVBMessageType +{ + IUSIVB_SET_APS_ATTITUDE_ENGINE, + IUSIVB_SI_EDS_CUTOFF, + IUSIVB_SII_EDS_CUTOFF, + IUSIVB_SIVB_EDS_CUTOFF, + IUSIVB_SET_SI_THRUSTER_DIR, ///< Set thruster direction. + IUSIVB_SET_SII_THRUSTER_DIR, + IUSIVB_SET_SIVB_THRUSTER_DIR, + IUSIVB_SI_SWITCH_SELECTOR, + IUSIVB_SII_SWITCH_SELECTOR, + IUSIVB_SIVB_SWITCH_SELECTOR, + IUSIVB_GET_SI_THRUST_OK, + IUSIVB_GET_SII_THRUST_OK, + IUSIVB_GET_SIVB_THRUST_OK, + IUSIVB_GET_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF, + IUSIVB_GET_SII_PROPELLANT_DEPLETION_ENGINE_CUTOFF, + IUSIVB_GET_SIB_LOW_LEVEL_SENSORS_DRY, + IUSIVB_GET_SI_INBOARD_ENGINE_OUT, + IUSIVB_GET_SI_OUTBOARD_ENGINE_OUT, + IUSIVB_GET_SII_FUEL_TANK_PRESSURE, + IUSIVB_GET_SIVB_FUEL_TANK_PRESSURE, + IUSIVB_GET_SIVB_LOX_TANK_PRESSURE, + IUSIVB_GET_SIX_SIVB_NOT_SEPARATED, + IUSIVB_GET_SIC_SII_NOT_SEPARATED, + IUSIVB_GET_SII_INTERSTAGE_NOT_SEPARATED, +}; + +//IU connector class + +class IUConnector : public Connector +{ +public: + IUConnector(); + virtual ~IUConnector(); + + void SetIU(IU *iu) { ourIU = iu; }; +protected: + IU *ourIU; +}; + /// /// \ingroup Connectors /// \brief IU to CSM command connector. /// -class IUToCSMCommandConnector : public Connector +class IUToCSMCommandConnector : public IUConnector { public: IUToCSMCommandConnector(); @@ -167,25 +180,17 @@ class IUToCSMCommandConnector : public Connector int GetAGCAttitudeError(int axis); bool IsEDSBusPowered(int eds); - void SetIU(IU *iu) { ourIU = iu; }; - void TLIBegun(); void TLIEnded(); -protected: - - IU *ourIU; }; -/// -/// \ingroup Connectors -/// \brief IU to LV command connector. -/// -class IUToLVCommandConnector : public Connector +// IU to S-IVB command connector (NEW) +class IUToSIVBCommandConnector : public IUConnector { public: - IUToLVCommandConnector(); - ~IUToLVCommandConnector(); + IUToSIVBCommandConnector(); + ~IUToSIVBCommandConnector(); void SetAPSAttitudeEngine(int n, bool on); void SIEDSCutoff(bool cut); @@ -194,10 +199,34 @@ class IUToLVCommandConnector : public Connector void SetSIThrusterDir(int n, double yaw, double pitch); void SetSIIThrusterDir(int n, double yaw, double pitch); void SetSIVBThrusterDir(double yaw, double pitch); - void SISwitchSelector(int channel); void SIISwitchSelector(int channel); void SIVBSwitchSelector(int channel); + void GetSIThrustOK(bool *ok, int n); + void GetSIIThrustOK(bool *ok); + bool GetSIVBThrustOK(); + bool GetSIPropellantDepletionEngineCutoff(); + bool GetSIIPropellantDepletionEngineCutoff(); + bool GetSIBLowLevelSensorsDry(); + bool GetSIInboardEngineOut(); + bool GetSIOutboardEngineOut(); + double GetSIIFuelTankPressurePSI(); + double GetSIVBLOXTankPressurePSI(); + double GetSIVBFuelTankPressurePSI(); + bool SIXSIVBNotSeparated(); + bool SICSIINotSeparated(); + bool SIIInterstageNotSeparated(); +}; + +/// +/// \ingroup Connectors +/// \brief IU to LV command connector. (OLD) +/// +class IUToLVCommandConnector : public Connector +{ +public: + IUToLVCommandConnector(); + ~IUToLVCommandConnector(); void SeparateStage(int stage); void SetStage(int stage); @@ -205,35 +234,48 @@ class IUToLVCommandConnector : public Connector void DeploySLAPanel(); int GetStage(); - double GetMass(); - void GetGlobalOrientation(VECTOR3 &arot); - bool GetWeightVector(VECTOR3 &w); void GetInertialAccel(VECTOR3 &a); void GetRotationMatrix(MATRIX3 &rot); void GetAngularVel(VECTOR3 &avel); - double GetMissionTime(); int GetVehicleNo(); - void GetSIThrustOK(bool *ok, int n); - bool GetSIPropellantDepletionEngineCutoff(); - bool GetSIInboardEngineOut(); - bool GetSIOutboardEngineOut(); - bool GetSIBLowLevelSensorsDry(); - void GetSIIThrustOK(bool *ok); - bool GetSIIPropellantDepletionEngineCutoff(); - bool GetSIVBThrustOK(); - double GetSIIFuelTankPressurePSI(); - double GetSIVBLOXTankPressurePSI(); - double GetSIVBFuelTankPressurePSI(); void GetRelativePos(OBJHANDLE ref, VECTOR3 &v); void GetRelativeVel(OBJHANDLE ref, VECTOR3 &v); - void GetGlobalVel(VECTOR3 &v); - - OBJHANDLE GetGravityRef(); bool CSMSeparationSensed(); }; +//IU to IU ESE command connector +class IUToIUESECommandConnector : public IUConnector +{ +public: + IUToIUESECommandConnector(); + ~IUToIUESECommandConnector(); + + bool ReceiveMessage(Connector *from, ConnectorMessage &m); + + bool IsUmbilicalConnected(); + + bool GetCommandVehicleLiftoffIndicationInhibit(); + bool GetExcessiveRollRateAutoAbortInhibit(int n); + bool GetExcessivePitchYawRateAutoAbortInhibit(int n); + bool GetTwoEngineOutAutoAbortInhibit(int n); + bool GetGSEOverrateSimulate(int n); + bool GetEDSPowerInhibit(); + bool PadAbortRequest(); + bool GetEngineThrustIndicationEnableInhibitA(); + bool GetEngineThrustIndicationEnableInhibitB(); + bool EDSLiftoffInhibitA(); + bool EDSLiftoffInhibitB(); + bool GetSIBurnModeSubstitute(); + bool GetGuidanceReferenceRelease(); + bool GetQBallSimulateCmd(); + bool GetEDSAutoAbortSimulate(int n); + bool GetEDSLVCutoffSimulate(int n); + bool GetSICOutboardEnginesCantInhibit(); + bool GetSICOutboardEnginesCantSimulate(); +}; + /// /// This class simulates the Saturn Instrument Unit, which flew the Saturn launch vehicle /// prior to the CSM seperating from the SIVb. @@ -251,6 +293,7 @@ class IU { virtual void ConnectToCSM(Connector *csmConnector); virtual void ConnectToLV(Connector *CommandConnector); + virtual void ConnectToSIVB(Connector *CommandConnector); void DisconnectIU(); @@ -278,17 +321,15 @@ class IU { virtual bool GetSIIInboardEngineOut() { return false; } virtual bool GetSIIOutboardEngineOut() { return false; } virtual bool GetSIIEnginesOut(); - bool IsUmbilicalConnected(); bool GetSCControlPoweredFlight() { return SCControlPoweredFlight; } VECTOR3 GetTheodoliteAlignment(double azimuth); - virtual void ConnectUmbilical(IUUmbilical *umb); - virtual void DisconnectUmbilical(); - virtual bool DCSUplink(int type, void *upl); IUToCSMCommandConnector* GetCommandConnector() { return &commandConnector; } IUToLVCommandConnector* GetLVCommandConnector() { return &lvCommandConnector; } + IUToSIVBCommandConnector* GetSIVBCommandConnector() { return &sivbCommandConnector; } + IUToIUESECommandConnector* GetIUToIUESECommandConnector() { return &iuToIUESECommandConnector; } //Subsystem Access virtual EDS* GetEDS() = 0; @@ -303,27 +344,6 @@ class IU { IUAuxiliaryPowerDistributor2 *GetAuxPowrDistr() { return &AuxiliaryPowerDistributor2; } IUControlSignalProcessor *GetContSigProc() { return &ControlSignalProcessor; } - //ESE Functions - bool ESEGetCommandVehicleLiftoffIndicationInhibit(); - bool ESEGetExcessiveRollRateAutoAbortInhibit(int n); - bool ESEGetExcessivePitchYawRateAutoAbortInhibit(int n); - bool ESEGetTwoEngineOutAutoAbortInhibit(int n); - bool ESEGetGSEOverrateSimulate(int n); - bool ESEGetEDSPowerInhibit(); - bool ESEPadAbortRequest(); - bool ESEGetEngineThrustIndicationEnableInhibitA(); - bool ESEGetEngineThrustIndicationEnableInhibitB(); - bool ESEEDSLiftoffInhibitA(); - bool ESEEDSLiftoffInhibitB(); - bool ESEGetSIBurnModeSubstitute(); - bool ESEGetGuidanceReferenceRelease(); - bool ESEESEGetQBallSimulateCmd(); - bool ESEGetEDSAutoAbortSimulate(int n); - bool ESEGetEDSLVCutoffSimulate(int n); - - virtual bool ESEGetSICOutboardEnginesCantInhibit() { return false; } - virtual bool ESEGetSICOutboardEnginesCantSimulate() { return false; } - protected: int State; @@ -348,6 +368,11 @@ class IU { /// IUToLVCommandConnector lvCommandConnector; + //Connector to S-IVB + IUToSIVBCommandConnector sivbCommandConnector; + //Connector to IU UESE + IUToIUESECommandConnector iuToIUESECommandConnector; + //Subsystems: //603A29 @@ -363,8 +388,6 @@ class IU { IUAuxiliaryPowerDistributor2 AuxiliaryPowerDistributor2; //601A24 IUControlSignalProcessor ControlSignalProcessor; - - IUUmbilical *IuUmb; }; class IU1B :public IU @@ -416,10 +439,6 @@ class IUSV :public IU DelayTimer *GetEngineCutoffEnableTimer() { return &EngineCutoffEnableTimer; } LVDC* GetLVDC() { return &lvdc; } - //ESE Functions - bool ESEGetSICOutboardEnginesCantInhibit(); - bool ESEGetSICOutboardEnginesCantSimulate(); - protected: //603A28 LVDCSV lvdc; diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1b.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1b.cpp index a432710d0f..1d0ca50c3d 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1b.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1b.cpp @@ -28,7 +28,6 @@ #include "connector.h" #include "nasspdefs.h" -#include "sivb.h" #include "s1b.h" #include @@ -70,78 +69,6 @@ PARTICLESTREAMSPEC srb_exhaust = { PARTICLESTREAMSPEC::ATM_FLAT, 1.0, 1.0 }; -SIBConnector::SIBConnector() -{ - OurVessel = NULL; -} - -SIBConnector::~SIBConnector() -{ - -} - -SIBtoSIVBConnector::SIBtoSIVBConnector() -{ - type = SIVB_SI_COMMAND; -} - -SIBtoSIVBConnector::~SIBtoSIVBConnector() -{ - -} - -bool SIBtoSIVBConnector::ReceiveMessage(Connector *from, ConnectorMessage &m) -{ - // - // Sanity check. - // - - if (m.destination != type) - { - return false; - } - - SIVBSIMessageType messageType; - - messageType = (SIVBSIMessageType)m.messageType; - - switch (messageType) - { - case SIVB_SI_SWITCH_SELECTOR: - if (OurVessel) - { - OurVessel->SwitchSelector(m.val1.iValue); - } - return true; - case SIVB_SI_THRUSTER_DIR: - if (OurVessel) - { - OurVessel->SetH1ThrusterDir(m.val1.iValue, m.val2.dValue, m.val3.dValue); - } - return true; - case SIVB_SI_SIB_LOW_LEVEL_SENSORS_DRY: - if (OurVessel) - { - m.val1.bValue = OurVessel->GetLowLevelSensorsDry(); - } - return true; - case SIVB_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF: - if (OurVessel) - { - m.val1.bValue = OurVessel->GetSIPropellantDepletionEngineCutoff(); - } - return true; - case SIVB_SI_GETSITHRUSTOK: - if (OurVessel) - { - OurVessel->GetSIThrustOK((bool *)m.val1.pValue); - } - return true; - } - - return false; -} - S1B::S1B (OBJHANDLE hObj, int fmodel) : ProjectApolloConnectorVessel(hObj, fmodel), SIB_SIVB_Sep("SIB-SIVB-Sep-Pyros", Panelsdk), sibsys(this, th_main, ph_main, SIB_SIVB_Sep, LaunchS, SShutS) @@ -180,10 +107,8 @@ sibsys(this, th_main, ph_main, SIB_SIVB_Sep, LaunchS, SShutS) VehicleNo = 0; RetroNum = 4; - sibSIVBConnector.SetSIB(this); - hDockSIVB = CreateDock(_V(0.0, 0, 16.70513 + 5.7023), _V(0, 0, 1), _V(0, 1, 0)); - RegisterConnector(0, &sibSIVBConnector); + RegisterConnector(0, sibsys.GetSIBtoSIVBConnector()); Panelsdk.RegisterVessel(this); Panelsdk.InitFromFile("ProjectApollo\\SIBSystems"); @@ -595,31 +520,6 @@ void S1B::SetState(S1BSettings &state) sibsys.Set_SIB_SIVB_SeparationCmdLatch(); } -void S1B::SetH1ThrusterDir(int n, double beta_y, double beta_p) -{ - sibsys.SetThrusterDir(n, beta_y, beta_p); -} - -void S1B::SwitchSelector(int channel) -{ - sibsys.SwitchSelector(channel); -} - -bool S1B::GetLowLevelSensorsDry() -{ - return sibsys.GetLowLevelSensorsDry(); -} - -bool S1B::GetSIPropellantDepletionEngineCutoff() -{ - return sibsys.GetOutboardEnginesCutoff(); -} - -void S1B::GetSIThrustOK(bool *ok) -{ - sibsys.GetThrustOK(ok); -} - DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel) { return new S1B(hvessel, flightmodel); diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1b.h b/Orbitersdk/samples/ProjectApollo/src_saturn/s1b.h index c2f73ca384..aaeb84b414 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1b.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1b.h @@ -97,29 +97,6 @@ enum S1bState S1B_STATE_WAITING ///< S1b is idle after motor burnout. }; -class S1B; - -class SIBConnector : public Connector -{ -public: - SIBConnector(); - ~SIBConnector(); - - void SetSIB(S1B *sat) { OurVessel = sat; }; - -protected: - S1B *OurVessel; -}; - -class SIBtoSIVBConnector : public SIBConnector -{ -public: - SIBtoSIVBConnector(); - ~SIBtoSIVBConnector(); - - bool ReceiveMessage(Connector *from, ConnectorMessage &m); -}; - /// /// This code simulates the seperated S1b stage. Basically it simulates thrust decay if there is any fuel /// left, fires any retro rockets to push it away from the Saturn and then sits around waiting to be deleted. @@ -182,12 +159,6 @@ class S1B : public ProjectApolloConnectorVessel { virtual SIBSystems* GetSIB() { return &sibsys; } - void SetH1ThrusterDir(int n, double beta_y, double beta_p); - void SwitchSelector(int channel); - bool GetLowLevelSensorsDry(); - bool GetSIPropellantDepletionEngineCutoff(); - void GetSIThrustOK(bool *ok); - protected: void AddEngines(); @@ -226,6 +197,4 @@ class S1B : public ProjectApolloConnectorVessel { SIBSystems sibsys; Pyro SIB_SIVB_Sep; Sound LaunchS, SShutS; - - SIBtoSIVBConnector sibSIVBConnector; }; diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1bsystems.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1bsystems.cpp index 4b8971c9ff..13b96769cc 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1bsystems.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1bsystems.cpp @@ -31,8 +31,203 @@ See http://nassp.sourceforge.net/license/ for more details. #include "saturn.h" #include "papi.h" +#include "sivbsystems.h" #include "s1bsystems.h" #include "SCMUmbilical.h" +#include "TailUmbilicalInterface.h" + +SIBSystemsConnector::SIBSystemsConnector() +{ + ourSIB = NULL; +} + +SIBSystemsConnector::~SIBSystemsConnector() +{ + +} + +SIBtoSIVBConnector::SIBtoSIVBConnector() +{ + type = SIVB_SIX_COMMAND; + ourSIB = NULL; +} + +SIBtoSIVBConnector::~SIBtoSIVBConnector() +{ + +} + +bool SIBtoSIVBConnector::ReceiveMessage(Connector *from, ConnectorMessage &m) +{ + // + // Sanity check. + // + + if (m.destination != type) + { + return false; + } + + SIVBSIXMessageType messageType; + + messageType = (SIVBSIXMessageType)m.messageType; + + switch (messageType) + { + case SIVB_SIX_IS_CONNECTED: + if (ourSIB) + { + return true; + } + break; + case SIVB_SIX_SI_SWITCH_SELECTOR: + if (ourSIB) + { + ourSIB->SwitchSelector(m.val1.iValue); + return true; + } + break; + case SIVB_SIX_SI_THRUSTER_DIR: + if (ourSIB) + { + ourSIB->SetThrusterDir(m.val1.iValue, m.val2.dValue, m.val3.dValue); + return true; + } + break; + case SIVB_SIX_SIB_LOW_LEVEL_SENSORS_DRY: + if (ourSIB) + { + m.val1.bValue = ourSIB->GetLowLevelSensorsDry(); + return true; + } + break; + case SIVB_SIX_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF: + if (ourSIB) + { + m.val1.bValue = ourSIB->GetOutboardEnginesCutoff(); + return true; + } + break; + case SIVB_SIX_GETSITHRUSTOK: + if (ourSIB) + { + ourSIB->GetThrustOK((bool *)m.val1.pValue); + return true; + } + break; + case SIVB_SIX_SI_EDS_CUTOFF: + if (ourSIB) + { + ourSIB->EDSEnginesCutoff(m.val1.bValue); + return true; + } + break; + case SIVB_SIX_GET_SI_INBOARD_ENGINE_OUT: + if (ourSIB) + { + m.val1.bValue = ourSIB->GetInboardEngineOut(); + return true; + } + break; + case SIVB_SIX_GET_SI_OUTBOARD_ENGINE_OUT: + if (ourSIB) + { + m.val1.bValue = ourSIB->GetOutboardEngineOut(); + return true; + } + break; + case SIVB_SIX_GET_SIX_SIVB_NOT_SEPARATED: + if (ourSIB) + { + m.val1.bValue = true; + return true; + } + break; + } + + return false; +} + +SIBToSIESEConnector::SIBToSIESEConnector() +{ + type = SIESE_SI_COMMAND; +} + +SIBToSIESEConnector::~SIBToSIESEConnector() +{ + +} + +bool SIBToSIESEConnector::IsUmbilicalConnected() +{ + return (connectedTo != NULL); +} + +bool SIBToSIESEConnector::GetSIBThrustOKSimulate(int eng, int n) +{ + ConnectorMessage m; + + m.destination = SIESE_SI_COMMAND; + m.messageType = SI_SIESE_GET_SI_THRUST_OK_SIMULATE; + m.val1.iValue = eng; + m.val2.iValue = n; + + if (SendMessage(m)) + { + return m.val1.bValue; + } + + return false; +} + +bool SIBToSIESEConnector::ReceiveMessage(Connector *from, ConnectorMessage &m) +{ + // + // Sanity check. + // + + if (m.destination != type) + { + return false; + } + + SIESEMessageType messageType; + + messageType = (SIESEMessageType)m.messageType; + + switch (messageType) + { + case SIESE_SI_SI_STAGE_LOGIC_CUTOFF: + if (ourSIB) + { + m.val1.bValue = ourSIB->GetEngineStop(); + return true; + } + break; + case SIESE_SI_SET_ENGINE_START: + if (ourSIB) + { + ourSIB->SetEngineStart(m.val1.iValue); + return true; + } + break; + case SIESE_SI_GSE_CUTOFF: + if (ourSIB) + { + ourSIB->GSEEnginesCutoff(m.val1.bValue); + return true; + } + break; + case SIESE_SI_THRUST_OK: + if (ourSIB) + { + ourSIB->GetThrustOK((bool*)m.val1.pValue); + return true; + } + break; + } + return false; +} H1Engine::H1Engine(VESSEL *v, THRUSTER_HANDLE &h1, bool cangimbal, double pcant, double ycant) :vessel(v), th_h1(h1) @@ -259,6 +454,8 @@ SIBSystems::SIBSystems(VESSEL *v, THRUSTER_HANDLE *h1, PROPELLANT_HANDLE &h1prop LaunchSound(LaunchS) { vessel = v; + sibSIVBConnector.SetSIBSystems(this); + sibSIESEConnector.SetSIBSystems(this); for (int i = 0;i < 8;i++) { @@ -306,8 +503,12 @@ SIBSystems::SIBSystems(VESSEL *v, THRUSTER_HANDLE *h1, PROPELLANT_HANDLE &h1prop h1engines[5] = &h1engine6; h1engines[6] = &h1engine7; h1engines[7] = &h1engine8; +} - SCMUmb = NULL; +SIBSystems::~SIBSystems() +{ + sibSIVBConnector.Disconnect(); + sibSIESEConnector.Disconnect(); } void SIBSystems::SaveState(FILEHANDLE scn) { @@ -437,11 +638,11 @@ void SIBSystems::Timestep(double misst, double simdt) { for (int j = 0;j < 3;j++) { - ThrustOK[i * 3 + j] = h1engines[i]->GetThrustOK() || ESEGetSIBThrustOKSimulate(i + 1, j + 1); + ThrustOK[i * 3 + j] = h1engines[i]->GetThrustOK() || sibSIESEConnector.GetSIBThrustOKSimulate(i + 1, j + 1); } } - if (IsUmbilicalConnected()) + if (sibSIESEConnector.IsUmbilicalConnected()) { LiftoffRelay = true; } @@ -801,30 +1002,6 @@ void SIBSystems::SwitchSelector(int channel) } } -void SIBSystems::ConnectUmbilical(SCMUmbilical *umb) -{ - SCMUmb = umb; -} - -void SIBSystems::DisconnectUmbilical() -{ - SCMUmb = NULL; -} - -bool SIBSystems::IsUmbilicalConnected() -{ - if (SCMUmb && SCMUmb->IsUmbilicalConnected()) return true; - - return false; -} - -bool SIBSystems::ESEGetSIBThrustOKSimulate(int eng, int n) -{ - if (!IsUmbilicalConnected()) return false; - - return SCMUmb->ESEGetSIThrustOKSimulate(eng, n); -} - void SIBSystems::GetThrustOK(bool *ok) { for (int i = 0;i < 24;i++) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1bsystems.h b/Orbitersdk/samples/ProjectApollo/src_saturn/s1bsystems.h index 7ee3d0f526..6b211b8661 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1bsystems.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1bsystems.h @@ -24,6 +24,8 @@ See http://nassp.sourceforge.net/license/ for more details. #pragma once +#include "connector.h" + class H1Engine { public: @@ -70,14 +72,49 @@ class H1Engine const double GIMBALLIMIT = 8.0*RAD; }; -class SCMUmbilical; class Pyro; class Sound; +class SIBSystems; + +class SIBSystemsConnector : public Connector +{ +public: + SIBSystemsConnector(); + virtual ~SIBSystemsConnector(); + void SetSIBSystems(SIBSystems *sib) { ourSIB = sib; }; +protected: + SIBSystems *ourSIB; +}; + +class SIBtoSIVBConnector : public SIBSystemsConnector +{ +public: + SIBtoSIVBConnector(); + ~SIBtoSIVBConnector(); + + bool ReceiveMessage(Connector *from, ConnectorMessage &m); +}; + +//S-IC to S-I Connector +class SIBToSIESEConnector : public SIBSystemsConnector +{ +public: + SIBToSIESEConnector(); + virtual ~SIBToSIESEConnector(); + + //S-IB to S-I ESE + bool IsUmbilicalConnected(); + bool GetSIBThrustOKSimulate(int eng, int n); + + //S-I ESE to S-IB + bool ReceiveMessage(Connector *from, ConnectorMessage &m); +}; class SIBSystems { public: SIBSystems(VESSEL *v, THRUSTER_HANDLE *h1, PROPELLANT_HANDLE &h1prop, Pyro &SIB_SIVB_Sep, Sound &LaunchS, Sound &SShutS); + virtual ~SIBSystems(); void Timestep(double misst, double simdt); void SaveState(FILEHANDLE scn); void LoadState(FILEHANDLE scn); @@ -108,13 +145,13 @@ class SIBSystems virtual bool GetEngineStop(); bool FireRetroRockets(); - virtual void ConnectUmbilical(SCMUmbilical *umb); - virtual void DisconnectUmbilical(); - bool IsUmbilicalConnected(); + SIBtoSIVBConnector * GetSIBtoSIVBConnector() { return &sibSIVBConnector; } + SIBToSIESEConnector * GetSIBToSIESEConnector() { return &sibSIESEConnector; } protected: double GetSumThrust(); - bool ESEGetSIBThrustOKSimulate(int eng, int n); + SIBtoSIVBConnector sibSIVBConnector; + SIBToSIESEConnector sibSIESEConnector; VESSEL *vessel; PROPELLANT_HANDLE &main_propellant; @@ -200,6 +237,4 @@ class SIBSystems bool ThrustOK[24]; bool OutboardEnginesCutoffSignal; - - SCMUmbilical *SCMUmb; }; \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1csystems.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1csystems.cpp index 9623fd76ec..22ef45ad82 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1csystems.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1csystems.cpp @@ -31,9 +31,182 @@ See http://nassp.sourceforge.net/license/ for more details. #include "saturn.h" #include "papi.h" #include "TSMUmbilical.h" - +#include "TailUmbilicalInterface.h" #include "s1csystems.h" +SICSystemsConnector::SICSystemsConnector() +{ + ourSIC = NULL; +} + +SICSystemsConnector::~SICSystemsConnector() +{ + +} + +SICToSIIConnector::SICToSIIConnector() +{ + type = SII_IS_SIC_COMMAND; +} + +SICToSIIConnector::~SICToSIIConnector() +{ + +} + +bool SICToSIIConnector::ReceiveMessage(Connector *from, ConnectorMessage &m) +{ + // + // Sanity check. + // + + if (m.destination != type) + { + return false; + } + + SIISICMessageType messageType; + + messageType = (SIISICMessageType)m.messageType; + + switch (messageType) + { + case SII_SIC_SI_THRUSTER_DIR: + if (ourSIC) + { + ourSIC->SetThrusterDir(m.val1.iValue, m.val2.dValue, m.val3.dValue); + return true; + } + break; + case SII_SIC_SI_EDS_CUTOFF: + if (ourSIC) + { + ourSIC->EDSEnginesCutoff(m.val1.bValue); + return true; + } + break; + case SII_SIC_SI_SWITCH_SELECTOR: + if (ourSIC) + { + ourSIC->SwitchSelector(m.val1.iValue); + return true; + } + break; + case SII_SIC_GETSITHRUSTOK: + if (ourSIC) + { + ourSIC->GetThrustOK((bool *)m.val1.pValue); + return true; + } + break; + case SII_SIC_PROPELLANT_DEPLETION_ENGINE_CUTOFF: + if (ourSIC) + { + m.val1.bValue = ourSIC->GetPropellantDepletionEngineCutoff(); + return true; + } + break; + case SII_SIC_GET_SI_INBOARD_ENGINE_OUT: + if (ourSIC) + { + m.val1.bValue = ourSIC->GetInboardEngineOut(); + return true; + } + break; + case SII_SIC_GET_SI_OUTBOARD_ENGINE_OUT: + if (ourSIC) + { + m.val1.bValue = ourSIC->GetOutboardEngineOut(); + return true; + } + break; + case SII_SIC_GET_SIC_SII_NOT_SEPARATED: + if (ourSIC) + { + m.val1.bValue = ourSIC->GetSICSIINotSeparated(); + return true; + } + break; + } + return false; +} + +SICToSIESEConnector::SICToSIESEConnector() +{ + type = SIESE_SI_COMMAND; +} + +SICToSIESEConnector::~SICToSIESEConnector() +{ + +} + +bool SICToSIESEConnector::GetSICThrustOKSimulate(int eng, int n) +{ + ConnectorMessage m; + + m.destination = SIESE_SI_COMMAND; + m.messageType = SI_SIESE_GET_SI_THRUST_OK_SIMULATE; + m.val1.iValue = eng; + m.val2.iValue = n; + + if (SendMessage(m)) + { + return m.val1.bValue; + } + + return false; +} + +bool SICToSIESEConnector::ReceiveMessage(Connector *from, ConnectorMessage &m) +{ + // + // Sanity check. + // + + if (m.destination != type) + { + return false; + } + + SIESEMessageType messageType; + + messageType = (SIESEMessageType)m.messageType; + + switch (messageType) + { + case SIESE_SI_SI_STAGE_LOGIC_CUTOFF: + if (ourSIC) + { + m.val1.bValue = ourSIC->GetEngineStop(); + return true; + } + break; + case SIESE_SI_SET_ENGINE_START: + if (ourSIC) + { + ourSIC->SetEngineStart(m.val1.iValue); + return true; + } + break; + case SIESE_SI_GSE_CUTOFF: + if (ourSIC) + { + ourSIC->GSEEnginesCutoff(m.val1.bValue); + return true; + } + break; + case SIESE_SI_THRUST_OK: + if (ourSIC) + { + ourSIC->GetThrustOK((bool*)m.val1.pValue); + return true; + } + break; + } + return false; +} + F1Engine::F1Engine(VESSEL *v, THRUSTER_HANDLE &f1) :vessel(v), th_f1(f1) { @@ -290,15 +463,14 @@ SICSystems::SICSystems(VESSEL *v, THRUSTER_HANDLE *f1, PROPELLANT_HANDLE &f1prop f1engines[3] = &f1engine4; f1engines[4] = &f1engine5; - TSMUmb = NULL; + sicSIIConnector.SetSICSystems(this); + sicSIESEConnector.SetSICSystems(this); } SICSystems::~SICSystems() { - if (TSMUmb) - { - TSMUmb->AbortDisconnect(); - } + sicSIIConnector.Disconnect(); + sicSIESEConnector.Disconnect(); } void SICSystems::SaveState(FILEHANDLE scn) { @@ -363,7 +535,7 @@ void SICSystems::Timestep(double misst, double simdt) { for (int j = 0;j < 3;j++) { - ThrustOK[i * 3 + j] = f1engines[i]->GetThrustOK() || ESEGetSICThrustOKSimulate(i + 1, j + 1); + ThrustOK[i * 3 + j] = f1engines[i]->GetThrustOK() || sicSIESEConnector.GetSICThrustOKSimulate(i + 1, j + 1); } } @@ -593,33 +765,15 @@ bool SICSystems::GetOutboardEngineOut() return false; } -bool SICSystems::GetEngineStop() +bool SICSystems::GetSICSIINotSeparated() { - for (int i = 0;i < 5;i++) if (f1engines[i]->GetEngineStop()) return true; - - return false; -} - -void SICSystems::ConnectUmbilical(TSMUmbilical *umb) -{ - TSMUmb = umb; -} - -void SICSystems::DisconnectUmbilical() -{ - TSMUmb = NULL; + //TBD: GSE S-IC/S-II sep simulate + return true; } -bool SICSystems::IsUmbilicalConnected() +bool SICSystems::GetEngineStop() { - if (TSMUmb && TSMUmb->IsUmbilicalConnected()) return true; + for (int i = 0;i < 5;i++) if (f1engines[i]->GetEngineStop()) return true; return false; -} - -bool SICSystems::ESEGetSICThrustOKSimulate(int eng, int n) -{ - if (!IsUmbilicalConnected()) return false; - - return TSMUmb->ESEGetSIThrustOKSimulate(eng, n); } \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1csystems.h b/Orbitersdk/samples/ProjectApollo/src_saturn/s1csystems.h index 648f240e14..75bffd5b0e 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1csystems.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1csystems.h @@ -24,6 +24,44 @@ See http://nassp.sourceforge.net/license/ for more details. #pragma once +#include "connector.h" + +class SICSystems; + +class SICSystemsConnector : public Connector +{ +public: + SICSystemsConnector(); + virtual ~SICSystemsConnector(); + void SetSICSystems(SICSystems *sic) { ourSIC = sic; }; +protected: + SICSystems *ourSIC; +}; + +//S-IC to S-II Connector +class SICToSIIConnector : public SICSystemsConnector +{ +public: + SICToSIIConnector(); + virtual ~SICToSIIConnector(); + + bool ReceiveMessage(Connector *from, ConnectorMessage &m); +}; + +//S-IC to S-I Connector +class SICToSIESEConnector : public SICSystemsConnector +{ +public: + SICToSIESEConnector(); + virtual ~SICToSIESEConnector(); + + //S-IC to S-I ESE + bool GetSICThrustOKSimulate(int eng, int n); + + //S-I ESE to S-IC + bool ReceiveMessage(Connector *from, ConnectorMessage &m); +}; + class F1Engine { public: @@ -71,7 +109,6 @@ class F1Engine double yawPos; }; -class TSMUmbilical; class Pyro; class Sound; @@ -103,17 +140,16 @@ class SICSystems bool GetPropellantDepletionEngineCutoff(); bool GetInboardEngineOut(); bool GetOutboardEngineOut(); + bool GetSICSIINotSeparated(); virtual bool GetEngineStop(); - virtual void ConnectUmbilical(TSMUmbilical *umb); - virtual void DisconnectUmbilical(); - bool IsUmbilicalConnected(); + SICToSIIConnector * GetSICToSIIConnector() { return &sicSIIConnector; } + SICToSIESEConnector * GetSICToSIESEConnector() { return &sicSIESEConnector; } protected: bool TripleVoting(bool vote1, bool vote2, bool vote3); double GetSumThrust(); - bool ESEGetSICThrustOKSimulate(int eng, int n); VESSEL *vessel; PROPELLANT_HANDLE &main_propellant; @@ -141,5 +177,6 @@ class SICSystems bool ThrustOK[15]; - TSMUmbilical *TSMUmb; + SICToSIIConnector sicSIIConnector; + SICToSIESEConnector sicSIESEConnector; }; \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/saturn1b.h b/Orbitersdk/samples/ProjectApollo/src_saturn/saturn1b.h index b8d0fbf85f..dcf87da875 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/saturn1b.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/saturn1b.h @@ -63,18 +63,6 @@ friend class LVDC1B; /// void clbkPostStep (double simt, double simdt, double mjd); - /// - /// \brief LVDC "Switch Selector" staging support utility function - /// - void SISwitchSelector(int channel); - - void SIEDSCutoff(bool cut); - void GetSIThrustOK(bool *ok); - bool GetSIInboardEngineOut(); - bool GetSIOutboardEngineOut(); - bool GetSIPropellantDepletionEngineCutoff(); - bool GetSIBLowLevelSensorsDry(); - void SetSIThrusterDir(int n, double yaw, double pitch); double GetSIThrustLevel(); void ActivatePrelaunchVenting(); diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/saturnv.h b/Orbitersdk/samples/ProjectApollo/src_saturn/saturnv.h index b84443db01..920efb66b1 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/saturnv.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/saturnv.h @@ -79,26 +79,8 @@ class SaturnV: public Saturn { /// \todo Not implemented yet, see Saturn1b virtual void SetVentingJ2Thruster() {}; - /// - /// \brief LVDC "Switch Selector" staging support utility function - /// - void SISwitchSelector(int channel); - void SIISwitchSelector(int channel); - - void GetSIThrustOK(bool *ok); - void SIEDSCutoff(bool cut); - bool GetSIPropellantDepletionEngineCutoff(); - bool GetSIInboardEngineOut(); - bool GetSIOutboardEngineOut(); - void SetSIThrusterDir(int n, double yaw, double pitch); double GetSIThrustLevel(); - void GetSIIThrustOK(bool *ok); - void SIIEDSCutoff(bool cut); - bool GetSIIPropellantDepletionEngineCutoff(); - void SetSIIThrusterDir(int n, double yaw, double pitch); - double GetSIIFuelTankPressurePSI(); - SICSystems *GetSIC() { return sic; } // @@ -205,6 +187,7 @@ class SaturnV: public Saturn { SICSystems *sic; SIISystems *sii; + SIIInterstageSystems *sii_is; Pyro SICSIISepPyros; Pyro SIIInterstagePyros; diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/siisystems.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/siisystems.cpp index d6de3e329b..25bf5202ce 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/siisystems.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/siisystems.cpp @@ -33,6 +33,289 @@ See http://nassp.sourceforge.net/license/ for more details. #include "siisystems.h" +SIISystemsConnector::SIISystemsConnector() +{ + ourSII = NULL; +} + +SIISystemsConnector::~SIISystemsConnector() +{ + +} + +SIIToSIVBConnector::SIIToSIVBConnector() +{ + type = SIVB_SIX_COMMAND; +} + +SIIToSIVBConnector::~SIIToSIVBConnector() +{ + +} + +bool SIIToSIVBConnector::ReceiveMessage(Connector *from, ConnectorMessage &m) +{ + // + // Sanity check. + // + + if (m.destination != type) + { + return false; + } + + SIVBSIXMessageType messageType; + + messageType = (SIVBSIXMessageType)m.messageType; + + switch (messageType) + { + case SIVB_SIX_SI_THRUSTER_DIR: + if (ourSII) + { + ourSII->GetSIIToSIIInterstageConnector()->SetSIThrusterDir(m.val1.iValue, m.val2.dValue, m.val3.dValue); + return true; + } + break; + case SIVB_SIX_SII_THRUSTER_DIR: + if (ourSII) + { + ourSII->SetThrusterDir(m.val1.iValue, m.val2.dValue, m.val3.dValue); + return true; + } + break; + case SIVB_SIX_SI_EDS_CUTOFF: + if (ourSII) + { + ourSII->GetSIIToSIIInterstageConnector()->SIEDSCutoff(m.val1.bValue); + return true; + } + break; + case SIVB_SIX_SII_EDS_CUTOFF: + if (ourSII) + { + ourSII->EDSEnginesCutoff(m.val1.bValue); + return true; + } + break; + case SIVB_SIX_SI_SWITCH_SELECTOR: + if (ourSII) + { + ourSII->GetSIIToSIIInterstageConnector()->SISwitchSelector(m.val1.iValue); + return true; + } + break; + case SIVB_SIX_SII_SWITCH_SELECTOR: + if (ourSII) + { + ourSII->SwitchSelector(m.val1.iValue); + return true; + } + break; + case SIVB_SIX_GETSITHRUSTOK: + if (ourSII) + { + ourSII->GetSIIToSIIInterstageConnector()->GetSIThrustOK((bool *)m.val1.pValue, m.val2.iValue); + return true; + } + break; + case SIVB_SIX_GETSIITHRUSTOK: + if (ourSII) + { + ourSII->GetThrustOK((bool *)m.val1.pValue); + return true; + } + break; + case SIVB_SIX_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF: + if (ourSII) + { + m.val1.bValue = ourSII->GetSIIToSIIInterstageConnector()->GetSIPropellantDepletionEngineCutoff(); + return true; + } + break; + case SIVB_SIX_SII_PROPELLANT_DEPLETION_ENGINE_CUTOFF: + if (ourSII) + { + m.val1.bValue = ourSII->GetPropellantDepletionEngineCutoff(); + return true; + } + break; + case SIVB_SIX_GET_SI_INBOARD_ENGINE_OUT: + if (ourSII) + { + m.val1.bValue = ourSII->GetSIIToSIIInterstageConnector()->GetSIInboardEngineOut(); + return true; + } + break; + case SIVB_SIX_GET_SI_OUTBOARD_ENGINE_OUT: + if (ourSII) + { + m.val1.bValue = ourSII->GetSIIToSIIInterstageConnector()->GetSIOutboardEngineOut(); + return true; + } + break; + case SIVB_SIX_GET_SII_FUEL_TANK_PRESSURE: + if (ourSII) + { + m.val1.dValue = ourSII->GetLH2TankUllagePressurePSI(); + return true; + } + break; + case SIVB_SIX_GET_SIX_SIVB_NOT_SEPARATED: + if (ourSII) + { + m.val1.bValue = ourSII->GetSIISIVBNotSeparated(); + return true; + } + break; + case SIVB_SIX_GET_SIC_SII_NOT_SEPARATED: + if (ourSII) + { + m.val1.bValue = ourSII->GetSIIToSIIInterstageConnector()->GetSICSIINotSeparated(); + return true; + } + break; + case SIVB_SIX_GET_SII_INTERSTAGE_NOT_SEPARATED: + if (ourSII) + { + m.val1.bValue = ourSII->GetSIIToSIIInterstageConnector()->connectedTo != NULL; //TBD: Send to interstage, then back to S-II systems where a GSE simulate signal could be used + return true; + } + break; + } + return false; +} + +SIIToSIIInterstageConnector::SIIToSIIInterstageConnector() +{ + type = SII_SII_IS_COMMAND; +} + +SIIToSIIInterstageConnector::~SIIToSIIInterstageConnector() +{ + +} + +void SIIToSIIInterstageConnector::SetSIThrusterDir(int n, double yaw, double pitch) +{ + ConnectorMessage cm; + + cm.destination = SII_SII_IS_COMMAND; + cm.messageType = SII_SIC_SI_THRUSTER_DIR; + cm.val1.iValue = n; + cm.val2.dValue = yaw; + cm.val3.dValue = pitch; + + if (SendMessage(cm)) + { + return; + } +} + +void SIIToSIIInterstageConnector::SIEDSCutoff(bool cut) +{ + ConnectorMessage cm; + + cm.destination = SII_SII_IS_COMMAND; + cm.messageType = SII_SIC_SI_EDS_CUTOFF; + cm.val1.bValue = cut; + + if (SendMessage(cm)) + { + return; + } +} + +void SIIToSIIInterstageConnector::SISwitchSelector(int channel) +{ + ConnectorMessage cm; + + cm.destination = SII_SII_IS_COMMAND; + cm.messageType = SII_SIC_SI_SWITCH_SELECTOR; + cm.val1.iValue = channel; + + SendMessage(cm); +} + +void SIIToSIIInterstageConnector::GetSIThrustOK(bool *ok, int n) +{ + ConnectorMessage cm; + + cm.destination = SII_SII_IS_COMMAND; + cm.messageType = SII_SIC_GETSITHRUSTOK; + cm.val1.pValue = ok; + + if (SendMessage(cm)) + { + return; + } + + for (int i = 0; i < n; i++) + { + ok[i] = false; + } +} + +bool SIIToSIIInterstageConnector::GetSIPropellantDepletionEngineCutoff() +{ + ConnectorMessage cm; + + cm.destination = SII_SII_IS_COMMAND; + cm.messageType = SII_SIC_PROPELLANT_DEPLETION_ENGINE_CUTOFF; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +bool SIIToSIIInterstageConnector::GetSIInboardEngineOut() +{ + ConnectorMessage cm; + + cm.destination = SII_SII_IS_COMMAND; + cm.messageType = SII_SIC_GET_SI_INBOARD_ENGINE_OUT; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +bool SIIToSIIInterstageConnector::GetSIOutboardEngineOut() +{ + ConnectorMessage cm; + + cm.destination = SII_SII_IS_COMMAND; + cm.messageType = SII_SIC_GET_SI_OUTBOARD_ENGINE_OUT; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +bool SIIToSIIInterstageConnector::GetSICSIINotSeparated() +{ + ConnectorMessage cm; + + cm.destination = SII_SII_IS_COMMAND; + cm.messageType = SII_SIC_GET_SIC_SII_NOT_SEPARATED; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + SIISystems::SIISystems(VESSEL *v, THRUSTER_HANDLE *j2, PROPELLANT_HANDLE &j2prop, THGROUP_HANDLE &ull, Pyro &SII_Inter, Pyro &SII_SIVB_Sep, Sound &pushifts, Sound &SepS) :main_propellant(j2prop), ullage(ull), puShiftSound(pushifts), sepSound(SepS), j2engine1(v, j2[0]), @@ -71,6 +354,15 @@ SIISystems::SIISystems(VESSEL *v, THRUSTER_HANDLE *j2, PROPELLANT_HANDLE &j2prop j2engines[2] = &j2engine3; j2engines[3] = &j2engine4; j2engines[4] = &j2engine5; + + siiSIIInterstageConnector.SetSIISystems(this); + siiSIVBConnector.SetSIISystems(this); +} + +SIISystems::~SIISystems() +{ + siiSIIInterstageConnector.Disconnect(); + siiSIVBConnector.Disconnect(); } void SIISystems::SaveState(FILEHANDLE scn) { @@ -317,6 +609,12 @@ bool SIISystems::GetPropellantDepletionEngineCutoff() return false; } +bool SIISystems::GetSIISIVBNotSeparated() +{ + //TBD: ESE S-II/S-IVB sep simulate + return true; +} + void SIISystems::SwitchSelector(int channel) { switch (channel) @@ -498,4 +796,69 @@ void SIISystems::EDSEnginesCutoff(bool cut) j2engine4.ResetEDSCutoff(); j2engine5.ResetEDSCutoff(); } +} + +SIIInterstageSystemsConnector::SIIInterstageSystemsConnector() +{ + ourIS = NULL; +} + +SIIInterstageSystemsConnector::~SIIInterstageSystemsConnector() +{ + +} + +SIIInterstageToSIIConnector::SIIInterstageToSIIConnector() +{ + type = SII_SII_IS_COMMAND; +} + +SIIInterstageToSIIConnector::~SIIInterstageToSIIConnector() +{ + +} + +bool SIIInterstageToSIIConnector::ReceiveMessage(Connector *from, ConnectorMessage &m) +{ + // + // Sanity check. + // + + if (m.destination != type) + { + return false; + } + + //Directly forward the message + return ourIS->GetSIIInterstageToSICConnector()->ForwardMessage(m); +} + +SIIInterstageToSICConnector::SIIInterstageToSICConnector() +{ + type = SII_IS_SIC_COMMAND; +} + +SIIInterstageToSICConnector::~SIIInterstageToSICConnector() +{ + +} + +bool SIIInterstageToSICConnector::ForwardMessage(ConnectorMessage &m) +{ + //Directly forward the message + m.destination = type; + + return SendMessage(m); +} + +SIIInterstageSystems::SIIInterstageSystems() +{ + siiInterstageSIIConnector.SetSIIInterstageSystems(this); + siiInterstageSICConnector.SetSIIInterstageSystems(this); +} + +SIIInterstageSystems::~SIIInterstageSystems() +{ + siiInterstageSIIConnector.Disconnect(); + siiInterstageSICConnector.Disconnect(); } \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/siisystems.h b/Orbitersdk/samples/ProjectApollo/src_saturn/siisystems.h index caf287d525..0f37b153ad 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/siisystems.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/siisystems.h @@ -25,15 +25,69 @@ See http://nassp.sourceforge.net/license/ for more details. #pragma once #include "j2engine.h" +#include "connector.h" #define PUVALVE_CLOSED 0 #define PUVALVE_NULL 1 #define PUVALVE_OPEN 2 +//Messages to S-IC +enum SIISICMessageType +{ + SII_SIC_SI_THRUSTER_DIR, + SII_SIC_SI_EDS_CUTOFF, + SII_SIC_SI_SWITCH_SELECTOR, + SII_SIC_GETSITHRUSTOK, + SII_SIC_PROPELLANT_DEPLETION_ENGINE_CUTOFF, + SII_SIC_GET_SI_INBOARD_ENGINE_OUT, + SII_SIC_GET_SI_OUTBOARD_ENGINE_OUT, + SII_SIC_GET_SIC_SII_NOT_SEPARATED, +}; + +class SIISystems; + +class SIISystemsConnector : public Connector +{ +public: + SIISystemsConnector(); + virtual ~SIISystemsConnector(); + void SetSIISystems(SIISystems *sii) { ourSII = sii; }; +protected: + SIISystems *ourSII; +}; + +//S-II to S-IVB Connector +class SIIToSIVBConnector : public SIISystemsConnector +{ +public: + SIIToSIVBConnector(); + virtual ~SIIToSIVBConnector(); + + bool ReceiveMessage(Connector *from, ConnectorMessage &m); +}; + +//S-II to S-II Interstage Connector +class SIIToSIIInterstageConnector : public SIISystemsConnector +{ +public: + SIIToSIIInterstageConnector(); + virtual ~SIIToSIIInterstageConnector(); + + void SetSIThrusterDir(int n, double yaw, double pitch); + void SIEDSCutoff(bool cut); + void SISwitchSelector(int channel); + void GetSIThrustOK(bool *ok, int n); + bool GetSIPropellantDepletionEngineCutoff(); + bool GetSIInboardEngineOut(); + bool GetSIOutboardEngineOut(); + bool GetSICSIINotSeparated(); +}; + class SIISystems { public: SIISystems(VESSEL *v, THRUSTER_HANDLE *j2, PROPELLANT_HANDLE &j2prop, THGROUP_HANDLE &ull, Pyro &SII_Inter, Pyro &SII_SIVB_Sep, Sound &pushifts, Sound &SepS); + virtual ~SIISystems(); void Timestep(double simdt); void SaveState(FILEHANDLE scn); void LoadState(FILEHANDLE scn); @@ -68,6 +122,10 @@ class SIISystems //To IU double GetLH2TankUllagePressurePSI() { return LH2TankUllagePressurePSI; } + bool GetSIISIVBNotSeparated(); + + SIIToSIVBConnector* GetSIIToSIVBConnector() { return &siiSIVBConnector; } + SIIToSIIInterstageConnector* GetSIIToSIIInterstageConnector() { return &siiSIIInterstageConnector; } protected: void GetJ2ISP(double ratio, double &isp, double &ThrustAdjust); @@ -111,7 +169,58 @@ class SIISystems Sound &puShiftSound; Sound &sepSound; + + SIIToSIVBConnector siiSIVBConnector; + SIIToSIIInterstageConnector siiSIIInterstageConnector; }; #define SIISYSTEMS_START_STRING "SIISYSTEMS_BEGIN" -#define SIISYSTEMS_END_STRING "SIISYSTEMS_END" \ No newline at end of file +#define SIISYSTEMS_END_STRING "SIISYSTEMS_END" + +// INTERSTAGE, MOVE THIS LATER TO DIFFERENT FILES + +class SIIInterstageSystems; + +//Generic S-II interstage connector class +class SIIInterstageSystemsConnector : public Connector +{ +public: + SIIInterstageSystemsConnector(); + virtual ~SIIInterstageSystemsConnector(); + void SetSIIInterstageSystems(SIIInterstageSystems *is) { ourIS = is; }; +protected: + SIIInterstageSystems *ourIS; +}; + +//Connector from S-II interstage to S-II +class SIIInterstageToSIIConnector : public SIIInterstageSystemsConnector +{ +public: + SIIInterstageToSIIConnector(); + virtual ~SIIInterstageToSIIConnector(); + + bool ReceiveMessage(Connector *from, ConnectorMessage &m); +}; + +//Connector for S-II interstage to S-IC +class SIIInterstageToSICConnector : public SIIInterstageSystemsConnector +{ +public: + SIIInterstageToSICConnector(); + virtual ~SIIInterstageToSICConnector(); + + bool ForwardMessage(ConnectorMessage &m); +}; + +class SIIInterstageSystems +{ +public: + SIIInterstageSystems(); + virtual ~SIIInterstageSystems(); + + SIIInterstageToSIIConnector *GetSIIInterstageToSIIConnector() { return &siiInterstageSIIConnector; } + SIIInterstageToSICConnector *GetSIIInterstageToSICConnector() { return &siiInterstageSICConnector; } +protected: + SIIInterstageToSIIConnector siiInterstageSIIConnector; + SIIInterstageToSICConnector siiInterstageSICConnector; +}; \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.cpp index 77c760c09d..d4fa267c0a 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.cpp @@ -359,7 +359,6 @@ void SIVB::InitS4b() IUCommandConnector.SetSIVb(this); payloadSeparationConnector.SetSIVb(this); - sivbSIConnector.SetSIVb(this); if (!PanelSDKInitalised) { @@ -622,7 +621,7 @@ void SIVB::SetS4b() //Docking port for the connection to the lower stage (S-IB or S-II) CreateSISIVBInterface(); - RegisterConnector(i, &sivbSIConnector); + RegisterConnector(i, sivbsys->GetSIVBSIXConnector()); //Docking port for the connection to the stage attached to the front of the SLA (usually CSM, also Apollo 5 nosecap) hDockCSM = CreateDock(_V(0.0, 0, 14.8), _V(0, 0, 1), _V(1, 0, 0)); @@ -650,6 +649,7 @@ void SIVB::SetS4b() if (sivbsys) { sivbsys->SetVehicleNumber(VehicleNo); + sivbsys->GetSIVBIUConnector()->ConnectTo(iu->GetSIVBCommandConnector()); sivbsys->CreateParticleEffects(1400.0*0.0254); //CG location } @@ -1784,31 +1784,6 @@ void SIVB::UpdateLaunchTime(double dt) MissionTime -= dt; } -void SIVB::SetSIVBThrusterDir(double yaw, double pitch) -{ - sivbsys->SetThrusterDir(yaw, pitch); -} - -void SIVB::SetAPSAttitudeEngine(int n, bool on) -{ - sivbsys->SetAPSAttitudeEngine(n, on); -} - -bool SIVB::GetSIVBThrustOK() -{ - return sivbsys->GetThrustOK(); -} - -void SIVB::SIVBSwitchSelector(int channel) -{ - sivbsys->SwitchSelector(channel); -} - -void SIVB::SIVBEDSCutoff(bool cut) -{ - sivbsys->EDSEngineCutoff(cut); -} - double SIVB::GetSIVbPropellantMass() { @@ -2075,26 +2050,6 @@ void SIVB::MoveStrobes() trackLightPos[3].z = ((pos[3].x * sin(theta)) + (pos[3].z * cos(theta))) + hinge[3].z; } -void SIVB::SISwitchSelector(int channel) -{ - sivbSIConnector.SISwitchSelector(channel); -} - -void SIVB::SetSIThrusterDir(int n, double yaw, double pitch) -{ - sivbSIConnector.SetSIThrusterDir(n, yaw, pitch); -} - -bool SIVB::GetSIBLowLevelSensorsDry() -{ - return sivbSIConnector.GetLowLevelSensorsDry(); -} - -bool SIVB::GetSIPropellantDepletionEngineCutoff() -{ - return sivbSIConnector.GetSIPropellantDepletionEngineCutoff(); -} - void SIVB::HideAllMeshes() { @@ -2219,34 +2174,6 @@ bool SIVbToIUCommandConnector::ReceiveMessage(Connector *from, ConnectorMessage } return true; } - case IULV_GET_GLOBAL_ORIENTATION: - if (OurVessel) - { - VECTOR3 *arot = static_cast (m.val1.pValue); - VECTOR3 ar; - - OurVessel->GetGlobalOrientation(ar); - - *arot = ar; - return true; - } - break; - - case IULV_GET_MASS: - if (OurVessel) - { - m.val1.dValue = OurVessel->GetMass(); - return true; - } - break; - - case IULV_GET_GRAVITY_REF: - if (OurVessel) - { - m.val1.hValue = OurVessel->GetGravityRef(); - return true; - } - break; case IULV_GET_RELATIVE_POS: if (OurVessel) @@ -2280,22 +2207,6 @@ bool SIVbToIUCommandConnector::ReceiveMessage(Connector *from, ConnectorMessage } break; - case IULV_GET_GLOBAL_VEL: - if (OurVessel) - { - OurVessel->GetGlobalVel(*(VECTOR3 *) m.val1.pValue); - return true; - } - break; - - case IULV_GET_WEIGHTVECTOR: - if (OurVessel) - { - m.val2.bValue = OurVessel->GetWeightVector(*(VECTOR3 *) m.val1.pValue); - return true; - } - break; - case IULV_GET_INERTIAL_ACCEL: if (OurVessel) { @@ -2320,46 +2231,6 @@ bool SIVbToIUCommandConnector::ReceiveMessage(Connector *from, ConnectorMessage } break; - case IULV_GET_SIVB_THRUST_OK: - if (OurVessel) - { - m.val1.bValue = OurVessel->GetSIVBThrustOK(); - return true; - } - break; - - case IULV_SIVB_EDS_CUTOFF: - if (OurVessel) - { - OurVessel->SIVBEDSCutoff(m.val1.bValue); - return true; - } - break; - - case IULV_SET_APS_ATTITUDE_ENGINE: - if (OurVessel) - { - OurVessel->SetAPSAttitudeEngine(m.val1.iValue, m.val2.bValue); - return true; - } - break; - - case IULV_SET_SIVB_THRUSTER_DIR: - if (OurVessel) - { - OurVessel->SetSIVBThrusterDir(m.val1.dValue, m.val2.dValue); - return true; - } - break; - - case IULV_SIVB_SWITCH_SELECTOR: - if (OurVessel) - { - OurVessel->SIVBSwitchSelector(m.val1.iValue); - return true; - } - break; - case IULV_CSM_SEPARATION_SENSED: if (OurVessel) { @@ -2367,35 +2238,6 @@ bool SIVbToIUCommandConnector::ReceiveMessage(Connector *from, ConnectorMessage return true; } break; - - case IULV_SI_SWITCH_SELECTOR: - if (OurVessel) - { - OurVessel->SISwitchSelector(m.val1.iValue); - return true; - } - break; - case IULV_SET_SI_THRUSTER_DIR: - if (OurVessel) - { - OurVessel->SetSIThrusterDir(m.val1.iValue, m.val2.dValue, m.val3.dValue); - return true; - } - break; - case IULV_GET_SIB_LOW_LEVEL_SENSORS_DRY: - if (OurVessel) - { - m.val1.bValue = OurVessel->GetSIBLowLevelSensorsDry(); - return true; - } - break; - case IULV_GET_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF: - if (OurVessel) - { - m.val1.bValue = OurVessel->GetSIPropellantDepletionEngineCutoff(); - return true; - } - break; case IULV_NOSECAP_JETTISON: if (OurVessel) { @@ -2417,13 +2259,6 @@ bool SIVbToIUCommandConnector::ReceiveMessage(Connector *from, ConnectorMessage return true; } break; - case IULV_GET_SI_THRUST_OK: - if (OurVessel) - { - OurVessel->GetSIVBSIConnector()->GetSIThrustOK((bool *)m.val1.pValue, m.val2.iValue); - return true; - } - break; } return false; @@ -2473,88 +2308,4 @@ bool PayloadToSLACommandConnector::ReceiveMessage(Connector *from, ConnectorMess } return false; -} - -SIVBToSIConnector::SIVBToSIConnector() -{ - type = SIVB_SI_COMMAND; - OurVessel = 0; -} - -SIVBToSIConnector::~SIVBToSIConnector() -{ - -} - -void SIVBToSIConnector::SISwitchSelector(int channel) -{ - ConnectorMessage cm; - - cm.destination = SIVB_SI_COMMAND; - cm.messageType = SIVB_SI_SWITCH_SELECTOR; - cm.val1.iValue = channel; - - SendMessage(cm); -} - -void SIVBToSIConnector::SetSIThrusterDir(int n, double yaw, double pitch) -{ - ConnectorMessage cm; - - cm.destination = SIVB_SI_COMMAND; - cm.messageType = SIVB_SI_THRUSTER_DIR; - cm.val1.iValue = n; - cm.val2.dValue = yaw; - cm.val3.dValue = pitch; - - SendMessage(cm); -} - -bool SIVBToSIConnector::GetLowLevelSensorsDry() -{ - ConnectorMessage cm; - - cm.destination = SIVB_SI_COMMAND; - cm.messageType = SIVB_SI_SIB_LOW_LEVEL_SENSORS_DRY; - - if (SendMessage(cm)) - { - return cm.val1.bValue; - } - - return false; -} - -bool SIVBToSIConnector::GetSIPropellantDepletionEngineCutoff() -{ - ConnectorMessage cm; - - cm.destination = SIVB_SI_COMMAND; - cm.messageType = SIVB_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF; - - if (SendMessage(cm)) - { - return cm.val1.bValue; - } - - return false; -} - -void SIVBToSIConnector::GetSIThrustOK(bool *ok, int n) -{ - ConnectorMessage cm; - - cm.destination = SIVB_SI_COMMAND; - cm.messageType = SIVB_SI_GETSITHRUSTOK; - cm.val1.pValue = ok; - - if (SendMessage(cm)) - { - return; - } - - for (int i = 0;i < n;i++) - { - ok[i] = false; - } } \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.h b/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.h index b49689d197..746167bf68 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.h @@ -170,31 +170,6 @@ class PayloadToSLACommandConnector : public SIVbConnector bool ReceiveMessage(Connector *from, ConnectorMessage &m); }; -//Messages to S-IB or S-II -enum SIVBSIMessageType -{ - SIVB_SI_SWITCH_SELECTOR, - SIVB_SI_THRUSTER_DIR, - SIVB_SI_SIB_LOW_LEVEL_SENSORS_DRY, - SIVB_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF, - SIVB_SI_GETSITHRUSTOK -}; - -//S-IVB to S-IB or S-II Connector -class SIVBToSIConnector : public SIVbConnector -{ -public: - SIVBToSIConnector(); - ~SIVBToSIConnector(); - - void SISwitchSelector(int channel); - void SetSIThrusterDir(int n, double yaw, double pitch); - - bool GetLowLevelSensorsDry(); - bool GetSIPropellantDepletionEngineCutoff(); - void GetSIThrustOK(bool *ok, int n); -}; - /// /// This code simulates the seperated SIVb stage. Basically it simulates thrust decay if there is any fuel /// left, fires any retro rockets to push it away from the Saturn and then sits around waiting to be deleted. @@ -279,21 +254,8 @@ class SIVB : public ProjectApolloConnectorVessel { virtual double GetMissionTime(); virtual void UpdateLaunchTime(double dt); - bool GetSIVBThrustOK(); - - void SetSIVBThrusterDir(double yaw, double pitch); - void SetAPSAttitudeEngine(int n, bool on); - void SIVBEDSCutoff(bool cut); - void SIVBSwitchSelector(int channel); - - //Signals to lower stages - void SISwitchSelector(int channel); - void SetSIThrusterDir(int n, double yaw, double pitch); - bool GetSIBLowLevelSensorsDry(); - bool GetSIPropellantDepletionEngineCutoff(); - IU *GetIU() { return iu; }; - + SIVBSystems *GetSIVBSystems() { return sivbsys; } InertialData *GetInertialData() { return &inertialData; }; /// @@ -354,8 +316,6 @@ class SIVB : public ProjectApolloConnectorVessel { void ActivateStrobes(); void MoveStrobes(); - SIVBToSIConnector *GetSIVBSIConnector() { return &sivbSIConnector; } - protected: /// /// PanelSDK functions as a interface between the @@ -495,7 +455,6 @@ class SIVB : public ProjectApolloConnectorVessel { /// PayloadToSLACommandConnector payloadSeparationConnector; - SIVBToSIConnector sivbSIConnector; /// /// \brief Handle of docked vessel. diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/sivbsystems.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/sivbsystems.cpp index 5adab23e79..bfdd112b50 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/sivbsystems.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/sivbsystems.cpp @@ -31,6 +31,7 @@ See http://nassp.sourceforge.net/license/ for more details. #include "saturn.h" #include "papi.h" +#include "iu.h" #include "sivbsystems.h" static PARTICLESTREAMSPEC lh2_npv_venting_spec = { @@ -89,6 +90,490 @@ static PARTICLESTREAMSPEC lox_dump_venting_spec = { PARTICLESTREAMSPEC::ATM_FLAT, 1.0, 1.0 }; +SIVBSystemsConnector::SIVBSystemsConnector() +{ + ourSIVB = NULL; +} + +SIVBSystemsConnector::~SIVBSystemsConnector() +{ + +} + +SIVBToSIXConnector::SIVBToSIXConnector() +{ + type = SIVB_SIX_COMMAND; +} + +SIVBToSIXConnector::~SIVBToSIXConnector() +{ + +} + +bool SIVBToSIXConnector::HasGround() +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_IS_CONNECTED; + + if (SendMessage(cm)) + { + return true; + } + + return false; +} + +void SIVBToSIXConnector::SISwitchSelector(int channel) +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_SI_SWITCH_SELECTOR; + cm.val1.iValue = channel; + + SendMessage(cm); +} + +void SIVBToSIXConnector::SIISwitchSelector(int channel) +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_SII_SWITCH_SELECTOR; + cm.val1.iValue = channel; + + SendMessage(cm); +} + +void SIVBToSIXConnector::SetSIThrusterDir(int n, double yaw, double pitch) +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_SI_THRUSTER_DIR; + cm.val1.iValue = n; + cm.val2.dValue = yaw; + cm.val3.dValue = pitch; + + SendMessage(cm); +} + +void SIVBToSIXConnector::SetSIIThrusterDir(int n, double yaw, double pitch) +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_SII_THRUSTER_DIR; + cm.val1.iValue = n; + cm.val2.dValue = yaw; + cm.val3.dValue = pitch; + + SendMessage(cm); +} + +bool SIVBToSIXConnector::GetLowLevelSensorsDry() +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_SIB_LOW_LEVEL_SENSORS_DRY; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +bool SIVBToSIXConnector::GetSIPropellantDepletionEngineCutoff() +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +bool SIVBToSIXConnector::GetSIIPropellantDepletionEngineCutoff() +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_SII_PROPELLANT_DEPLETION_ENGINE_CUTOFF; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +void SIVBToSIXConnector::GetSIThrustOK(bool *ok, int n) +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_GETSITHRUSTOK; + cm.val1.pValue = ok; + cm.val2.iValue = n; + + if (SendMessage(cm)) + { + return; + } + + for (int i = 0; i < n; i++) + { + ok[i] = false; + } +} + +void SIVBToSIXConnector::GetSIIThrustOK(bool *ok) +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_GETSIITHRUSTOK; + cm.val1.pValue = ok; + + if (SendMessage(cm)) + { + return; + } + + for (int i = 0; i < 5; i++) + { + ok[i] = false; + } +} + +void SIVBToSIXConnector::SIEDSCutoff(bool cut) +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_SI_EDS_CUTOFF; + cm.val1.bValue = cut; + + if (SendMessage(cm)) + { + return; + } +} + +void SIVBToSIXConnector::SIIEDSCutoff(bool cut) +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_SII_EDS_CUTOFF; + cm.val1.bValue = cut; + + if (SendMessage(cm)) + { + return; + } +} + +bool SIVBToSIXConnector::GetSIInboardEngineOut() +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_GET_SI_INBOARD_ENGINE_OUT; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +bool SIVBToSIXConnector::GetSIOutboardEngineOut() +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_GET_SI_OUTBOARD_ENGINE_OUT; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +double SIVBToSIXConnector::GetSIIFuelTankPressurePSI() +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_GET_SII_FUEL_TANK_PRESSURE; + + if (SendMessage(cm)) + { + return cm.val1.dValue; + } + + return 0.0; +} + +bool SIVBToSIXConnector::SIXSIVBNotSeparated() +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_GET_SIX_SIVB_NOT_SEPARATED; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +bool SIVBToSIXConnector::SICSIINotSeparated() +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_GET_SIC_SII_NOT_SEPARATED; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +bool SIVBToSIXConnector::SIIInterstageNotSeparated() +{ + ConnectorMessage cm; + + cm.destination = SIVB_SIX_COMMAND; + cm.messageType = SIVB_SIX_GET_SII_INTERSTAGE_NOT_SEPARATED; + + if (SendMessage(cm)) + { + return cm.val1.bValue; + } + + return false; +} + +SIVBToIUConnector::SIVBToIUConnector() +{ + type = SIVB_IU_COMMAND; +} + +SIVBToIUConnector::~SIVBToIUConnector() +{ + +} + +bool SIVBToIUConnector::ReceiveMessage(Connector *from, ConnectorMessage &m) +{ + // +// Sanity check. +// + + if (m.destination != type) + { + return false; + } + + IUSIVBMessageType messageType; + + messageType = (IUSIVBMessageType)m.messageType; + + switch (messageType) + { + case IUSIVB_SET_APS_ATTITUDE_ENGINE: + if (ourSIVB) + { + ourSIVB->SetAPSAttitudeEngine(m.val1.iValue, m.val2.bValue); + return true; + } + break; + case IUSIVB_SI_EDS_CUTOFF: + if (ourSIVB) + { + ourSIVB->GetSIVBSIXConnector()->SIEDSCutoff(m.val1.bValue); + return true; + } + break; + case IUSIVB_SII_EDS_CUTOFF: + if (ourSIVB) + { + ourSIVB->GetSIVBSIXConnector()->SIIEDSCutoff(m.val1.bValue); + return true; + } + break; + case IUSIVB_SIVB_EDS_CUTOFF: + if (ourSIVB) + { + ourSIVB->EDSEngineCutoff(m.val1.bValue); + return true; + } + break; + case IUSIVB_SET_SI_THRUSTER_DIR: + if (ourSIVB) + { + ourSIVB->GetSIVBSIXConnector()->SetSIThrusterDir(m.val1.iValue, m.val2.dValue, m.val3.dValue); + return true; + } + break; + case IUSIVB_SET_SII_THRUSTER_DIR: + if (ourSIVB) + { + ourSIVB->GetSIVBSIXConnector()->SetSIIThrusterDir(m.val1.iValue, m.val2.dValue, m.val3.dValue); + return true; + } + break; + case IUSIVB_SET_SIVB_THRUSTER_DIR: + if (ourSIVB) + { + ourSIVB->SetThrusterDir(m.val1.dValue, m.val2.dValue); + return true; + } + break; + case IUSIVB_SI_SWITCH_SELECTOR: + if (ourSIVB) + { + ourSIVB->GetSIVBSIXConnector()->SISwitchSelector(m.val1.iValue); + return true; + } + break; + case IUSIVB_SII_SWITCH_SELECTOR: + if (ourSIVB) + { + ourSIVB->GetSIVBSIXConnector()->SIISwitchSelector(m.val1.iValue); + return true; + } + break; + case IUSIVB_SIVB_SWITCH_SELECTOR: + if (ourSIVB) + { + ourSIVB->SwitchSelector(m.val1.iValue); + return true; + } + break; + case IUSIVB_GET_SI_THRUST_OK: + if (ourSIVB) + { + ourSIVB->GetSIVBSIXConnector()->GetSIThrustOK((bool *)m.val1.pValue, m.val2.iValue); + return true; + } + break; + case IUSIVB_GET_SII_THRUST_OK: + if (ourSIVB) + { + ourSIVB->GetSIVBSIXConnector()->GetSIIThrustOK((bool *)m.val1.pValue); + return true; + } + break; + case IUSIVB_GET_SIVB_THRUST_OK: + if (ourSIVB) + { + m.val1.bValue = ourSIVB->GetThrustOK(); + return true; + } + break; + case IUSIVB_GET_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF: + if (ourSIVB) + { + m.val1.bValue = ourSIVB->GetSIVBSIXConnector()->GetSIPropellantDepletionEngineCutoff(); + return true; + } + break; + case IUSIVB_GET_SII_PROPELLANT_DEPLETION_ENGINE_CUTOFF: + if (ourSIVB) + { + m.val1.bValue = ourSIVB->GetSIVBSIXConnector()->GetSIIPropellantDepletionEngineCutoff(); + return true; + } + break; + case IUSIVB_GET_SIB_LOW_LEVEL_SENSORS_DRY: + if (ourSIVB) + { + m.val1.bValue = ourSIVB->GetSIVBSIXConnector()->GetLowLevelSensorsDry(); + return true; + } + break; + case IUSIVB_GET_SI_INBOARD_ENGINE_OUT: + if (ourSIVB) + { + m.val1.bValue = ourSIVB->GetSIVBSIXConnector()->GetSIInboardEngineOut(); + return true; + } + break; + case IUSIVB_GET_SI_OUTBOARD_ENGINE_OUT: + if (ourSIVB) + { + m.val1.bValue = ourSIVB->GetSIVBSIXConnector()->GetSIOutboardEngineOut(); + return true; + } + break; + case IUSIVB_GET_SII_FUEL_TANK_PRESSURE: + if (ourSIVB) + { + m.val1.dValue = ourSIVB->GetSIVBSIXConnector()->GetSIIFuelTankPressurePSI(); + return true; + } + break; + case IUSIVB_GET_SIVB_FUEL_TANK_PRESSURE: + if (ourSIVB) + { + m.val1.dValue = ourSIVB->GetLH2TankUllagePressurePSI(); + return true; + } + break; + case IUSIVB_GET_SIVB_LOX_TANK_PRESSURE: + if (ourSIVB) + { + m.val1.dValue = ourSIVB->GetLOXTankUllagePressurePSI(); + return true; + } + break; + case IUSIVB_GET_SIX_SIVB_NOT_SEPARATED: + if (ourSIVB) + { + m.val1.bValue = ourSIVB->GetSIVBSIXConnector()->SIXSIVBNotSeparated(); + return true; + } + break; + case IUSIVB_GET_SIC_SII_NOT_SEPARATED: + if (ourSIVB) + { + m.val1.bValue = ourSIVB->GetSIVBSIXConnector()->SICSIINotSeparated(); + return true; + } + break; + case IUSIVB_GET_SII_INTERSTAGE_NOT_SEPARATED: + if (ourSIVB) + { + m.val1.bValue = ourSIVB->GetSIVBSIXConnector()->SIIInterstageNotSeparated(); + return true; + } + break; + } + return false; +} + //Constants const double BTU = 1055.06; // BTU to Jouls const double R = 8314.4621; // (L*Pa) / (mol*K) @@ -275,6 +760,8 @@ SIVBSystems::SIVBSystems(VESSEL *v, THRUSTER_HANDLE &j2, PROPELLANT_HANDLE &j2pr { vessel = v; + sivbSIXConnector.SetSIVBSystems(this); + sivbIUConnector.SetSIVBSystems(this); LH2_NPV_Stream1 = NULL; LH2_NPV_Stream2 = NULL; @@ -322,6 +809,8 @@ SIVBSystems::~SIVBSystems() vessel->DelExhaustStream(LOX_Dump_Stream); LOX_Dump_Stream = NULL; } + sivbSIXConnector.Disconnect(); + sivbIUConnector.Disconnect(); } void SIVBSystems::SaveState(FILEHANDLE scn) { @@ -672,7 +1161,7 @@ void SIVBSystems::Timestep(double simdt) HeliumControlDeenergizedTimer.SetRunning(true); } EngineStart4 = (EngineStop || SparksDeenergized); - EngineStartLockUp = (EngineStart || SparkSystemOn); //TBD: Require S-II/S-IVB staging + EngineStartLockUp = ((EngineStart && !sivbSIXConnector.HasGround()) || SparkSystemOn); //TBD: Require S-II/S-IVB staging SparkSystemOn = (EngineStartLockUp && K101 && !EngineStart4); EngineStart3 = HeliumControlOn || SparkSystemOn; HeliumControlOn = (EngineStart3 && K101 && !HeliumControlDeenergizedTimer.ContactClosed()) || J2SignalF; diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/sivbsystems.h b/Orbitersdk/samples/ProjectApollo/src_saturn/sivbsystems.h index 68e03b0458..d836fff043 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/sivbsystems.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/sivbsystems.h @@ -30,6 +30,79 @@ See http://nassp.sourceforge.net/license/ for more details. #define PUVALVE_NULL 1 #define PUVALVE_OPEN 2 +class BaseSIVBSystems; +class SIVBSystems; + +//Messages to S-IB or S-II +enum SIVBSIXMessageType +{ + SIVB_SIX_IS_CONNECTED, + SIVB_SIX_SI_THRUSTER_DIR, + SIVB_SIX_SII_THRUSTER_DIR, + SIVB_SIX_SIB_LOW_LEVEL_SENSORS_DRY, + SIVB_SIX_SI_PROPELLANT_DEPLETION_ENGINE_CUTOFF, + SIVB_SIX_SII_PROPELLANT_DEPLETION_ENGINE_CUTOFF, + SIVB_SIX_GETSITHRUSTOK, + SIVB_SIX_GETSIITHRUSTOK, + SIVB_SIX_SI_EDS_CUTOFF, + SIVB_SIX_SII_EDS_CUTOFF, + SIVB_SIX_SI_SWITCH_SELECTOR, + SIVB_SIX_SII_SWITCH_SELECTOR, + SIVB_SIX_GET_SI_INBOARD_ENGINE_OUT, + SIVB_SIX_GET_SI_OUTBOARD_ENGINE_OUT, + SIVB_SIX_GET_SII_FUEL_TANK_PRESSURE, + SIVB_SIX_GET_SIX_SIVB_NOT_SEPARATED, + SIVB_SIX_GET_SIC_SII_NOT_SEPARATED, + SIVB_SIX_GET_SII_INTERSTAGE_NOT_SEPARATED, +}; + +class SIVBSystemsConnector : public Connector +{ +public: + SIVBSystemsConnector(); + virtual ~SIVBSystemsConnector(); + void SetSIVBSystems(SIVBSystems *sivb) { ourSIVB = sivb; }; +protected: + SIVBSystems *ourSIVB; +}; + +//S-IVB to S-IB or S-II Connector +class SIVBToSIXConnector : public SIVBSystemsConnector +{ +public: + SIVBToSIXConnector(); + virtual ~SIVBToSIXConnector(); + + bool HasGround(); + void SISwitchSelector(int channel); + void SIISwitchSelector(int channel); + void SetSIThrusterDir(int n, double yaw, double pitch); + void SetSIIThrusterDir(int n, double yaw, double pitch); + + bool GetLowLevelSensorsDry(); + bool GetSIPropellantDepletionEngineCutoff(); + bool GetSIIPropellantDepletionEngineCutoff(); + void GetSIThrustOK(bool *ok, int n); + void GetSIIThrustOK(bool *ok); + void SIEDSCutoff(bool cut); + void SIIEDSCutoff(bool cut); + bool GetSIInboardEngineOut(); + bool GetSIOutboardEngineOut(); + double GetSIIFuelTankPressurePSI(); + bool SIXSIVBNotSeparated(); + bool SICSIINotSeparated(); + bool SIIInterstageNotSeparated(); +}; + +class SIVBToIUConnector : public SIVBSystemsConnector +{ +public: + SIVBToIUConnector(); + virtual ~SIVBToIUConnector(); + + bool ReceiveMessage(Connector *from, ConnectorMessage &m); +}; + //This has class has everything that needs to be copied from Saturn to S-IVB class class BaseSIVBSystems { @@ -210,6 +283,9 @@ class SIVBSystems : public BaseSIVBSystems public: virtual ~SIVBSystems(); + SIVBToSIXConnector* GetSIVBSIXConnector() { return &sivbSIXConnector; } + SIVBToIUConnector* GetSIVBIUConnector() { return &sivbIUConnector; } + void RecalculateEngineParameters(double BaseThrust); virtual void RecalculateEngineParameters() = 0; virtual void SetSIVBMixtureRatio(double ratio) = 0; @@ -268,6 +344,8 @@ class SIVBSystems : public BaseSIVBSystems void BurnerShutdown(); VESSEL *vessel; + SIVBToSIXConnector sivbSIXConnector; //Connector to S-IB (Saturn IB) or S-II (Saturn V) + SIVBToIUConnector sivbIUConnector; //Connector to IU THRUSTER_HANDLE &j2engine; THRUSTER_HANDLE *apsThrusters; THRUSTER_HANDLE *ullage; diff --git a/Orbitersdk/samples/ProjectApollo/src_sys/connector.h b/Orbitersdk/samples/ProjectApollo/src_sys/connector.h index 3ceb5df56a..79aadf1400 100644 --- a/Orbitersdk/samples/ProjectApollo/src_sys/connector.h +++ b/Orbitersdk/samples/ProjectApollo/src_sys/connector.h @@ -33,7 +33,7 @@ enum ConnectorType { NO_CONNECTION, ///< Dummy. CSM_IU_COMMAND, ///< Passes commands and data between CSM and IU. - LV_IU_COMMAND, ///< Passes commands between launch vehicle and IU. + LV_IU_COMMAND, ///< Passes commands between launch vehicle and IU. (GET RID OF THS) CSM_LEM_DOCKING, ///< Docking connector between CSM and LEM. LEM_CSM_POWER, ///< Power connection from CSM to LEM. MFD_PANEL_INTERFACE, ///< Connector from an MFD to a panel. @@ -41,10 +41,14 @@ enum ConnectorType CHECKLIST_DATA_INTERFACE, ///< Data connector from checklist controller to vessel PAYLOAD_SLA_CONNECT, ///< Passes commands and data between payload and SIVb. CSM_PAYLOAD_COMMAND, ///< Docking connector between CSM and Payload - SIVB_SI_COMMAND, ///< Docking connector between S-IVB and S-IB/S-II - SII_SIC_COMMAND, ///< Docking connector between S-II and S-IC + SIVB_SIX_COMMAND, ///< Docking connector between S-IVB and S-IB/S-II + SII_SII_IS_COMMAND, ///< Docking connector between S-II and S-II Interstage + SII_IS_SIC_COMMAND, ///< Docking connector between S-II Interstage and S-IC RADAR_RF_SIGNAL, ///< Radar connector betwen LM rendezvous radar amd CSM rendezvous radar transponder VHF_RNG, + SIVB_IU_COMMAND, ///< Passes commands between S-IVB and IU. + IUESE_IU_COMMAND, ///< Passes commands between IU ESE and IU + SIESE_SI_COMMAND, ///< Passes commands between SI ESE and S-I }; #define VIRTUAL_CONNECTOR_PORT (0xffff) ///< Port ID for 'virtual' connectors which don't physically exist. From 3b5c62039a285fa445ffa8cdfe9c3b82fed5e2b7 Mon Sep 17 00:00:00 2001 From: Matthew W Hume Date: Tue, 29 Apr 2025 22:37:41 -0400 Subject: [PATCH 16/17] TD points --- .../src_saturn/S1C_S2_IntStage.cpp | 33 +++++++++++++++++++ .../src_saturn/S1C_S2_IntStage.h | 3 ++ .../samples/ProjectApollo/src_saturn/sii.h | 2 ++ 3 files changed, 38 insertions(+) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp index d23a1b785b..f7e772afc7 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.cpp @@ -68,6 +68,39 @@ void S1C_S2_Interstage::clbkSaveState(FILEHANDLE scn) VESSEL4::clbkSaveState(scn); } +void S1C_S2_Interstage::SetupTouchdownPoints() +{ + double td_mass = 2214000.0; + double td_width = 10.0; + double td_tdph = -49.0; + double td_height = 40.0; + + static DWORD ntdp = 4; + static TOUCHDOWNVTX td[8]; + double stiffness = (-1) * (td_mass * 9.80655) / (3 * -0.05); + double damping = 0.9 * (2 * sqrt(td_mass * stiffness)); + for (int i = 0; i < 4; i++) { + td[i].damping = damping; + td[i].mu = 3; + td[i].mu_lng = 3; + td[i].stiffness = stiffness; + } + td[0].pos.x = -cos(30 * RAD) * td_width; + td[0].pos.y = -sin(30 * RAD) * td_width; + td[0].pos.z = td_tdph; + td[1].pos.x = 0; + td[1].pos.y = 1 * td_width; + td[1].pos.z = td_tdph; + td[2].pos.x = cos(30 * RAD) * td_width; + td[2].pos.y = -sin(30 * RAD) * td_width; + td[2].pos.z = td_tdph; + td[3].pos.x = 0; + td[3].pos.y = 0; + td[3].pos.z = td_tdph + td_height; + + SetTouchdownPoints(td, ntdp); +} + //void S1C_S2_Interstage::clbkLoadStateEx(FILEHANDLE scn, void* vstatus) //{ //} diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h index 39c03b863d..e3c46c769e 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/S1C_S2_IntStage.h @@ -45,6 +45,9 @@ class S1C_S2_Interstage : public ProjectApolloConnectorVessel { //void clbkGetRadiationForce(const VECTOR3& mflux, VECTOR3& F, VECTOR3& pos); protected: + + void SetupTouchdownPoints(); + DOCKHANDLE hSIIDock, hSICDock; PROPELLANT_HANDLE ULLAGE_PROP[8]; THRUSTER_HANDLE ULLAGE_MOTORS[8]; diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/sii.h b/Orbitersdk/samples/ProjectApollo/src_saturn/sii.h index 7a9a6b7001..dce91bfc84 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/sii.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/sii.h @@ -179,4 +179,6 @@ class SII : public VESSEL2 { THRUSTER_HANDLE th_retro[4], th_main[5]; THGROUP_HANDLE thg_retro, thg_main; PROPELLANT_HANDLE ph_retro, ph_main; + + DOCKHANDLE hSIVbDock, hSICSIIIntStgDock; }; From 84ef66d1af4028b6d04a8d6a9d0156b4f9461579 Mon Sep 17 00:00:00 2001 From: indy91 Date: Sun, 22 Jun 2025 11:04:58 +0200 Subject: [PATCH 17/17] Fix S-IVB destructor CTD from trying to disconnect a connector that had already been deleted --- .../samples/ProjectApollo/src_saturn/s1c.cpp | 40 ++++++------------- .../samples/ProjectApollo/src_saturn/s1c.h | 26 +----------- .../samples/ProjectApollo/src_saturn/sivb.cpp | 2 +- .../ProjectApollo/src_sys/connector.cpp | 5 ++- .../samples/ProjectApollo/src_sys/connector.h | 13 ++++-- 5 files changed, 28 insertions(+), 58 deletions(-) diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp index 8edd657f2e..893cfb7a5f 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.cpp @@ -26,14 +26,14 @@ #include "s1c.h" -S1C::S1C (OBJHANDLE hObj, int fmodel) : ProjectApolloConnectorVessel(hObj, fmodel) +S1C::S1C (OBJHANDLE hObj, int fmodel) : ProjectApolloConnectorVessel(hObj, fmodel), +SICSIISepPyros("SICSIISepPyros", Panelsdk) { InitS1c(); } S1C::~S1C() { - delete(SICSIISepPyros); delete(sicSystems); } @@ -420,8 +420,8 @@ void S1C::clbkSetClassCaps (FILEHANDLE cfg) SetupTouchdownPoints(); hDockSII = CreateDock(_V(0.0, 0.0, 20.169), _V(0, 0, 1), _V(0, 1, 0)); - SICSIISepPyros = new Pyro("SICSIISepPyros", Panelsdk); - sicSystems = new SICSystems(this, th_main, ph_main, Pyro(*SICSIISepPyros), LaunchS, SShutS, CurrentThrust); + sicSystems = new SICSystems(this, th_main, ph_main, SICSIISepPyros, LaunchS, SShutS, CurrentThrust); + RegisterConnector(0, sicSystems->GetSICToSIIConnector(), true); } void S1C::LoadMeshes(bool lowres) @@ -441,8 +441,15 @@ void S1C::LoadMeshes(bool lowres) } void S1C::clbkDockEvent(int dock, OBJHANDLE connected) - { + if (connected) + { + DockConnectors(dock); + } + else + { + UndockConnectors(dock); + } } bool S1C::clbkLoadGenericCockpit () @@ -580,25 +587,4 @@ DLLCLBK void ovcExit (VESSEL *vessel) { if (vessel) delete (S1C *)vessel; -} - -SICConnector::SICConnector() -{ -} - -SICConnector::~SICConnector() -{ -} - -SICtoSIIConnector::SICtoSIIConnector() -{ -} - -SICtoSIIConnector::~SICtoSIIConnector() -{ -} - -bool SICtoSIIConnector::ReceiveMessage(Connector* from, ConnectorMessage& m) -{ - return false; -} +} \ No newline at end of file diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h index 73fded6ec2..21599b5323 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/s1c.h @@ -110,29 +110,6 @@ enum S1cState S1C_STATE_WAITING ///< S1c is idle after motor burnout. }; -class S1C; - -class SICConnector : public Connector -{ -public: - SICConnector(); - ~SICConnector(); - - void SetSIC(S1C* sat) { OurVessel = sat; }; - -protected: - S1C* OurVessel; -}; - -class SICtoSIIConnector : public SICConnector -{ -public: - SICtoSIIConnector(); - ~SICtoSIIConnector(); - - bool ReceiveMessage(Connector* from, ConnectorMessage& m); -}; - /// /// This code simulates the S1c stage. Basically it simulates thrust decay if there is any fuel left, /// fires any retro rockets to push it away from the Saturn and then sits around waiting to be deleted. @@ -248,8 +225,7 @@ class S1C : public ProjectApolloConnectorVessel { //Move us into the SICSystems class eventually PanelSDK Panelsdk; SICSystems* sicSystems; - Pyro* SICSIISepPyros; - SICtoSIIConnector sibSIVBConnector; + Pyro SICSIISepPyros; //***********************\\\ Sound LaunchS, SShutS; diff --git a/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.cpp b/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.cpp index d4fa267c0a..7e9e988548 100644 --- a/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_saturn/sivb.cpp @@ -621,7 +621,7 @@ void SIVB::SetS4b() //Docking port for the connection to the lower stage (S-IB or S-II) CreateSISIVBInterface(); - RegisterConnector(i, sivbsys->GetSIVBSIXConnector()); + RegisterConnector(i, sivbsys->GetSIVBSIXConnector(), true); //Docking port for the connection to the stage attached to the front of the SLA (usually CSM, also Apollo 5 nosecap) hDockCSM = CreateDock(_V(0.0, 0, 14.8), _V(0, 0, 1), _V(1, 0, 0)); diff --git a/Orbitersdk/samples/ProjectApollo/src_sys/connector.cpp b/Orbitersdk/samples/ProjectApollo/src_sys/connector.cpp index 7472a59e2d..02dd287909 100644 --- a/Orbitersdk/samples/ProjectApollo/src_sys/connector.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_sys/connector.cpp @@ -255,6 +255,7 @@ ProjectApolloConnectorVessel::ProjectApolloConnectorVessel(OBJHANDLE hObj, int f { ConnectorList[i].port = 0; ConnectorList[i].c = NULL; + ConnectorList[i].IsManagedConnector = false; } ValidationValue = PACV_N_VALIDATION; @@ -266,7 +267,7 @@ ProjectApolloConnectorVessel::~ProjectApolloConnectorVessel() int i; for (i = 0; i < PACV_N_CONNECTORS; i++) { - if (ConnectorList[i].c) + if (ConnectorList[i].IsManagedConnector == false && ConnectorList[i].c) { ConnectorList[i].c->Disconnect(); } @@ -293,7 +294,7 @@ Connector *ProjectApolloConnectorVessel::GetConnector(int port, ConnectorType t) return NULL; } -bool ProjectApolloConnectorVessel::RegisterConnector(int port, Connector *c) +bool ProjectApolloConnectorVessel::RegisterConnector(int port, Connector *c, bool isManaged) { int i; diff --git a/Orbitersdk/samples/ProjectApollo/src_sys/connector.h b/Orbitersdk/samples/ProjectApollo/src_sys/connector.h index 79aadf1400..84aca60d00 100644 --- a/Orbitersdk/samples/ProjectApollo/src_sys/connector.h +++ b/Orbitersdk/samples/ProjectApollo/src_sys/connector.h @@ -276,8 +276,14 @@ class ProjectApolloConnectorVessel : public VESSEL4 { int port; Connector *c; - - ConnectorDefinition() { port = 0; c = 0; }; + /// + /// True if the connector is not a class member but is only managed by ProjectApolloConnectorVessel. These connectors + /// are not disconnected in the ProjectApolloConnectorVessel destructor because they might already be deleted. The class + /// that owns the connector has to take care of disconnecting it its destructor. + /// + bool IsManagedConnector; + + ConnectorDefinition() { port = 0; c = 0; IsManagedConnector = false; }; }; /// @@ -326,9 +332,10 @@ class ProjectApolloConnectorVessel : public VESSEL4 /// \brief Register a connector for use by other vessels. /// \param port Docking port number. /// \param c Pointer to a connector. + /// \param isManaged Connector is not a vessel class member and will not be disconnected in the destructor. /// \return True if registered, false if not (e.g. too many registered already). /// - bool RegisterConnector(int port, Connector *c); + bool RegisterConnector(int port, Connector *c, bool isManaged = false); #define PACV_N_VALIDATION 0x5a715a75