Avionics
Dropship Simulator
Relay.cpp
Go to the documentation of this file.
1 #include "../../Component.h"
2 
3 namespace Systems
4 {
5  void Relay::FrameMove(double fTime)
6  {
7  // evaluate control voltage
8  float controlVoltage = EvaluateDependency(System::Control);
9  if (controlVoltage >= pickupPressure) // has a signal
10  {
11  currentState = 1.0f;
12  }
13  else if (controlVoltage < dropoutPressure)
14  {
15  currentState = 0.0f;
16  }
18 
19  if (currentState != setState)
20  {
24  char msg[99];
25  sprintf_s(msg, 99, "Relay->FrameMove->%s control voltage changed: %f", name.c_str(), controlVoltage);
26  logger->Log(msg, Logger::Level::Info);
27  }
28 
29  float newCapacityPressureEtc;
30  if (currentState == 1.0f)
31  {
33  newCapacityPressureEtc = EvaluateDependency(system);
35  }
36  else
37  {
38  newCapacityPressureEtc = 0.0f;
39  currentLoad = 0.0f;
40  }
42 
43  if (newCapacityPressureEtc != capacityPressureEtc)
44  {
45  capacityPressureEtc = newCapacityPressureEtc;
46  char msg[99];
47  sprintf_s(msg, 99, "Relay->FrameMove->%s updated capacityPressureEtc to %f", name.c_str(), capacityPressureEtc);
48  logger->Log(msg, Logger::Level::Info);
49  }
50  }
51 }
float pickupPressure
Minimum pressure/voltage to activate.
Definition: Component.h:34
float dropoutPressure
Minimum pressure/voltage to keep active.
Definition: Component.h:36
These have to be in this order.
Definition: BaseComponent.h:12
std::string name
Definition: Component.h:21
void FrameMove(double fTime) override
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: Relay.cpp:5
float capacityPressureEtc
propogated supply
Definition: BaseComponent.h:24
float serviceLifeCycleHit
Power-on service life cycle hit.
Definition: Component.h:28
void PropogateLoad(System system)
Definition: Component.cpp:52
float serviceLifeRemaining
Definition: Component.h:48
void Log(const char *msg, Level level=Info, int errorCode=0)
These have to be in this order.
Definition: Logger.cpp:16
float EvaluateDependency(System system)
Definition: Component.cpp:35
Logger * logger
Definition: Component.h:15