Skip to content

Commit

Permalink
Merge pull request #1312 from rcflyinghokie/TMTransducers
Browse files Browse the repository at this point in the history
Implement docking probe temp sensor for telemetry
  • Loading branch information
indy91 authored Jan 4, 2025
2 parents 7740c4d + 637de6e commit 2634ec4
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Config/ProjectApollo/SaturnSystems.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,13 @@
0.04 0.25 12000.0
</RADIATOR>

#Structures
<RADIATOR> DOCKPROBE <0.0 0.0 1.0> 294.261
3.0 0.001 37648.2
</RADIATOR>

<HEATEXCHANGER> DOCKPROBEINCABIN 0 10.0 CABIN DOCKPROBE 274.0 275.0

# GSE (Ground Support Equipment) devices
<RADIATOR> GSERADIATOR <0.0 0.0 0.0> 270.0
100.0 0.0 10000000
Expand Down
2 changes: 1 addition & 1 deletion Orbitersdk/samples/ProjectApollo/src_csm/csm_telecom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2238,7 +2238,7 @@ unsigned char PCM::measure(int channel, int type, int ccode){
sat->GetRCSStatus( RCS_CM_RING_2, rcsStatus );
return(scale_data(rcsStatus.HeliumPressurePSI, 0, 5000));
case 22: // DOCKING PROBE TEMP
return(scale_data(0,-100,300));
return(scale_data(sat->DockProbeTempSensor.Voltage(), 0.0, 5.0));
case 23: // UNKNOWN - HBR ONLY
return(0);
case 24: // SM HE TK A PRESS
Expand Down
46 changes: 44 additions & 2 deletions Orbitersdk/samples/ProjectApollo/src_csm/dockingprobe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,26 @@ DockingProbe::~DockingProbe()
// Nothing for now.
}

void DockingProbe::Init(Saturn *s)
{
saturn = s;
DockProbe = (h_Radiator *)saturn->Panelsdk.GetPointerByString("HYDRAULIC:DOCKPROBE");
DockProbeHX = (h_HeatExchanger *)saturn->Panelsdk.GetPointerByString("HYDRAULIC:DOCKPROBEINCABIN");
}

bool DockingProbe::IsInstalled()

{
if (OurVessel->HasProbe == false || IsHardDocked())
{
return false;
}
else
{
return true;
}
}

void DockingProbe::Extend()

{
Expand Down Expand Up @@ -361,11 +381,33 @@ void DockingProbe::UpdatePort(VECTOR3 off,double simdt)
}


void DockingProbe::SystemTimestep(double simdt)
void DockingProbe::SystemTimestep(double simdt)

{
if (ExtendingRetracting) {
DCPower.DrawPower(100.0); // The real power consumption is unknown yet
DCPower.DrawPower(100.0); // The real power consumption is unknown yet, max would be 240W (10A*28V)
}

if (!IsInstalled())
{
DockProbeHX->SetPumpOn();
DockProbe->rad = 0.0;
DockProbe->isolation = 0.0;
}
else
{
DockProbeHX->SetPumpOff();
DockProbe->rad = 3.0;
DockProbe->isolation = 0.001;
}

if (!IsPowered())
{
saturn->DockProbeTempSensor.WireTo(NULL);
}
else
{
saturn->DockProbeTempSensor.WireTo(&saturn->Panel276CB2);
}
}

Expand Down
6 changes: 6 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_csm/dockingprobe.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ class DockingProbe {
Sound &undocksound, Sound &dockfailedsound, PanelSDK &p);
virtual ~DockingProbe();

void Init(Saturn *s);
double GetStatus() { return Status; }
bool IsDocked() { return Docked; }
bool IsInstalled();
bool IsHardDocked();
bool IsExtended() { return (Status == DOCKINGPROBE_STATUS_EXTENDED); };
bool IsRetracted() { return (Status == DOCKINGPROBE_STATUS_RETRACTED); };
Expand All @@ -84,6 +86,7 @@ class DockingProbe {
double CollisionDetection(VECTOR3 prbP, VECTOR3 prbD, VECTOR3 drgV, VECTOR3 drgA);
bool IsPowered() { return DCPower.Voltage() > SP_MIN_DCVOLTAGE; };

Saturn *saturn;
bool Enabled;
double Status;
int ExtendingRetracting;
Expand All @@ -97,6 +100,9 @@ class DockingProbe {
bool FirstTimeStepDone;
bool UndockNextTimestep;

h_Radiator *DockProbe;
h_HeatExchanger *DockProbeHX;

///
/// Number of docking events to ignore. This is required in special cases, such as LEM creation, and
/// the state is not saved; the intention is that the count will only be set in the same timestep when
Expand Down
12 changes: 12 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_csm/satsystems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ void Saturn::SystemsInit() {
WasteH2ODumpTempSensor.Init(&Panel276CB1, (h_Tank*)Panelsdk.GetPointerByString("HYDRAULIC:WATERDUMPNOZZLE"));
UrineDumpTempSensor.Init(&Panel276CB2, (h_Tank*)Panelsdk.GetPointerByString("HYDRAULIC:URINEDUMPNOZZLE"));

dockingprobe.Init(this);
DockProbeTempSensor.Init(&Panel276CB2, (h_Radiator *)Panelsdk.GetPointerByString("HYDRAULIC:DOCKPROBE"));

// Optics initialization
optics.Init(this);

Expand Down Expand Up @@ -1153,6 +1156,14 @@ void Saturn::SystemsTimestep(double simt, double simdt, double mjd) {
// Various debug prints
//------------------------------------------------------------------------------------

// Structure Temperature Debug Lines
/*
double *DockProbeTemp = (double *)Panelsdk.GetPointerByString("HYDRAULIC:DOCKPROBE:TEMP");
int *DockProbeHX = (int *)Panelsdk.GetPointerByString("HYDRAULIC:DOCKPROBEINCABIN:PUMP");
//sprintf(oapiDebugString(), "Volts: %.2f Temp: %.4f Installed: %d HX: %d", DockProbeTempSensor.Voltage(), KelvinToFahrenheit(*DockProbeTemp), dockingprobe.IsInstalled(), *DockProbeHX);
*/

// GSE Cryo Debug Lines
/*
double *GSEO2CryoPress = (double *)Panelsdk.GetPointerByString("HYDRAULIC:GSECRYOO2DEWAR:PRESS");
Expand All @@ -1163,6 +1174,7 @@ void Saturn::SystemsTimestep(double simt, double simdt, double mjd) {
double *GSEH2CryoTemp = (double *)Panelsdk.GetPointerByString("HYDRAULIC:GSECRYOH2DEWAR:TEMP");
double *H2Tank1Temp = (double *)Panelsdk.GetPointerByString("HYDRAULIC:H2TANK1:TEMP");
double *H2Tank2Temp = (double *)Panelsdk.GetPointerByString("HYDRAULIC:H2TANK2:TEMP");
//sprintf(oapiDebugString(), "GSEPress: %.3f GSETemp: %.3f O2T1Temp: %.3f O2T2Temp: %.3f", *GSEO2CryoPress *PSI, KelvinToFahrenheit(*GSEO2CryoTemp), KelvinToFahrenheit(*O2Tank1Temp), KelvinToFahrenheit(*O2Tank2Temp));
//sprintf(oapiDebugString(), "GSEPress: %.3f GSETemp: %.3f H2T1Temp: %.3f H2T2Temp: %.3f", *GSEH2CryoPress *PSI, KelvinToFahrenheit(*GSEH2CryoTemp), KelvinToFahrenheit(*H2Tank1Temp), KelvinToFahrenheit(*H2Tank2Temp));
*/
Expand Down
1 change: 1 addition & 0 deletions Orbitersdk/samples/ProjectApollo/src_csm/saturn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ Saturn::Saturn(OBJHANDLE hObj, int fmodel) : ProjectApolloConnectorVessel (hObj,
SPSFuelFeedTempSensor("SPS-Fuel-Feed-Temp-Sensor", 0.0, 200.0),
SPSOxidizerFeedTempSensor("SPS-Oxidizer-Feed-Temp-Sensor", 0.0, 200.0),
SPSEngVlvTempSensor("SPS-Engine-Valve-Temp-Sensor", 0.0, 200.0),
DockProbeTempSensor("Docking-Probe-Temp-Sensor", -100.0, 300.0),
vesim(&cbCSMVesim, this),
CueCards(vcidx, this, 11),
Failures(this)
Expand Down
2 changes: 2 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_csm/saturn.h
Original file line number Diff line number Diff line change
Expand Up @@ -3624,6 +3624,8 @@ class Saturn: public ProjectApolloConnectorVessel, public PanelSwitchListener {
TemperatureTransducer WasteH2ODumpTempSensor;
TemperatureTransducer UrineDumpTempSensor;

TemperatureTransducer DockProbeTempSensor;

protected:

// CM Optics
Expand Down

0 comments on commit 2634ec4

Please sign in to comment.