Avionics
Dropship Simulator
Switch.cpp
Go to the documentation of this file.
1 #include "../../Component.h"
2 
3 namespace Systems
4 {
5  void Switch::FrameMove(double fTime)
6  {
7  if (currentState != setState)
8  {
12 
13  char msg[99];
14  sprintf_s(msg, 99, "Switch->FrameMove->%s setState changed: %f", name.c_str(), setState);
15  logger->Log(msg, Logger::Level::Info);
16  }
17 
18  float newCapacityPressureEtc;
19  if (currentState == 1.0f)
20  {
21  newCapacityPressureEtc = EvaluateDependency(System::Electrical); // this guy is Control but he needs electrical power
22  }
23  else
24  {
25  newCapacityPressureEtc = 0.0f;
26  }
27 
28  if (newCapacityPressureEtc != capacityPressureEtc)
29  {
30  capacityPressureEtc = newCapacityPressureEtc;
31  char msg[99];
32  sprintf_s(msg, 99, "Switch->FrameMove->%s updated voltage to %f", name.c_str(), capacityPressureEtc);
33  logger->Log(msg, Logger::Level::Info);
34  }
35 
36  currentLoad = 0;
38  }
39 }
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: Switch.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