Avionics
Dropship Simulator
Component.h
Go to the documentation of this file.
1 #pragma once
2 
5 #include "Dependency.h"
6 
7 namespace Systems
8 {
9  class Component : public BaseComponent
10  {
11  private:
12  Component() = default;
13 
14  protected:
15  Logger* logger = nullptr;
16 
17  public:
18  GUID attachedTo;// = GUID_NULL; // always a component
20 
21  std::string name;
22  std::vector<Dependency> dependencies;
23 
24  // componentInfo
26  float averageServiceLife = 0.0f;
28  float serviceLifeCycleHit = 0.0f;
29 
30  float weight = 0.0f; // we have to keep these for the integrity of the file
31  float cost = 0.0f; // we have to keep these for the integrity of the file
32 
34  float pickupPressure = 0.0f;
36  float dropoutPressure = 0.0f;
37 
38  float maxPressure = 0.0f;
39  float loadDraw = 0.0f;
40  float minTemp = 0.0f;
41  float maxTemp = 0.0f;
42  float maxCapacity = 0.0f;
43  std::string make, model, description; // we have to keep these for the integrity of the file
45 
46  // these get updated by the sim
47  float temperature = 0.0f; // I don't think we read these directly, we need sensors to do that ... and we don't care about connector temperatures
48  float serviceLifeRemaining = 0.0f; // hours, no one gets to know this
51  float setState = -999.0f;
52  float currentState = -999.0f;
53 
55  double lastTimeProcessed = 0;
56  float currentLoad = 0;
57 
58  public:
59  explicit Component(Logger* prmLogger);
60 
61  virtual void FrameMove(double fTime);
62 
66  virtual ~Component()
67  {
68  };
69 
72  };
73 
74  // Forward declarations for the components are below // -----------------------------------------------
75 
76 #pragma region Electrical
77  class Relay : public Component
81  {
82  public:
83  Relay(Logger* prmLogger) : Component(prmLogger)
84  {
85  };
86 
87  void FrameMove(double fTime) override;
88  };
89 
91  class Switch : public Component
92  {
93  public:
94  Switch(Logger* prmLogger) : Component(prmLogger)
95  {
96  };
97 
98  void FrameMove(double fTime) override;
99  };
100 
102  class TempSensor : public Component
103  {
104  public:
105  TempSensor(Logger* prmLogger) : Component(prmLogger)
106  {
107  };
108 
109  void FrameMove(double fTime) override;
110  };
111 
114  class Battery : public Component
115  {
116  public:
117  Battery(Logger* prmLogger) : Component(prmLogger)
118  {
119  };
120 
121  void FrameMove(double fTime) override;
122  };
123 
125  class Starter : public Component
126  {
127  public:
128  Starter(Logger* prmLogger) : Component(prmLogger)
129  {
130  };
131 
132  void FrameMove(double fTime) override;
133  };
134 
136  class N2 : public Component
137  {
138  public:
139  N2(Logger* prmLogger) : Component(prmLogger)
140  {
141  };
142 
143  void FrameMove(double fTime) override;
144  };
145 
147  class N1 : public Component
148  {
149  public:
150  N1(Logger* prmLogger) : Component(prmLogger)
151  {
152  };
153 
154  void FrameMove(double fTime) override;
155  };
156 
158  class Igniter : public Component
159  {
160  public:
161  Igniter(Logger* prmLogger) : Component(prmLogger)
162  {
163  };
164 
165  void FrameMove(double fTime) override;
166  };
167 
169  class Combustion : public Component
170  {
171  public:
172  Combustion(Logger* prmLogger) : Component(prmLogger)
173  {
174  };
175 
176  void FrameMove(double fTime) override;
177  };
178 
179 #pragma endregion
180 
182  class Real : public Component
183  {
184  public:
185  Real(Logger* prmLogger) : Component(prmLogger)
186  {
187  };
188 
189  void FrameMove(double fTime) override;
190  };
191 }
float pickupPressure
Minimum pressure/voltage to activate.
Definition: Component.h:34
Battery(Logger *prmLogger)
Definition: Component.h:117
void FrameMove(double fTime) override
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: Battery.cpp:5
starter is very specific, load differential
Definition: Component.h:125
void FrameMove(double fTime) override
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: Igniter.cpp:5
float dropoutPressure
Minimum pressure/voltage to keep active.
Definition: Component.h:36
Igniter(Logger *prmLogger)
Definition: Component.h:161
Igniter is very specific, on or off set, we get the pulses.
Definition: Component.h:158
virtual ~Component()
Definition: Component.h:66
N1(Logger *prmLogger)
Definition: Component.h:150
Definition: Logger.h:5
void FrameMove(double fTime) override
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: Starter.cpp:5
N1 is very specific, load differential.
Definition: Component.h:147
virtual void FrameMove(double fTime)
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: Component.cpp:11
These have to be in this order.
Definition: BaseComponent.h:12
Relay(Logger *prmLogger)
Definition: Component.h:83
std::string name
Definition: Component.h:21
Combustion Chamber is very specific, on or off set, we get the pulses.
Definition: Component.h:169
Component * attachedToComponent
Definition: Component.h:19
void FrameMove(double fTime) override
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: Switch.cpp:5
void FrameMove(double fTime) override
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: N2.cpp:5
float temperature
componentInfo
Definition: Component.h:47
void FrameMove(double fTime) override
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: Relay.cpp:5
std::string description
Definition: Component.h:43
void FrameMove(double fTime) override
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: Real.cpp:5
Switch(Logger *prmLogger)
Definition: Component.h:94
float averageServiceLife
Average service life in hours.
Definition: Component.h:26
std::string model
Definition: Component.h:43
float serviceLifeCycleHit
Power-on service life cycle hit.
Definition: Component.h:28
TempSensor(Logger *prmLogger)
Definition: Component.h:105
Switch is a direct-set (no control voltage, command from bus from physical switch) which takes a supp...
Definition: Component.h:91
void PropogateLoad(System system)
Definition: Component.cpp:52
float serviceLifeRemaining
Definition: Component.h:48
Real(Logger *prmLogger)
Definition: Component.h:185
Starter(Logger *prmLogger)
Definition: Component.h:128
double lastTimeProcessed
these don&#39;t get stored anywhere
Definition: Component.h:55
N2(Logger *prmLogger)
Definition: Component.h:139
std::vector< Dependency > dependencies
Definition: Component.h:22
float EvaluateDependency(System system)
Definition: Component.cpp:35
void FrameMove(double fTime) override
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: N1.cpp:5
void FrameMove(double fTime) override
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: Combustion.cpp:5
void FrameMove(double fTime) override
this is a generic unimplemented component framemove, eventually make a pure virtual function...
Definition: TempSensor.cpp:5
std::string make
Definition: Component.h:43
Combustion(Logger *prmLogger)
Definition: Component.h:172
N2 is very specific, load differential.
Definition: Component.h:136
Temperature sensor reads data from setState (or attached component?) and puts it on currentState assu...
Definition: Component.h:102
Logger * logger
Definition: Component.h:15
real components simply take setState and apply it to currentState, they run their own fault states ...
Definition: Component.h:182