SECircuitPath.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 #include "circuit/SECircuitNode.h"
6 #include "properties/SEScalarElectricCapacitance.h"
7 #include "properties/SEScalarElectricCurrent.h"
8 #include "properties/SEScalarElectricInductance.h"
9 #include "properties/SEScalarElectricResistance.h"
10 #include "properties/SEScalarFlowCompliance.h"
11 #include "properties/SEScalarVolumePerTime.h"
12 #include "properties/SEScalarFlowInertance.h"
13 #include "properties/SEScalarFlowResistance.h"
14 #include "properties/SEScalarHeatCapacitance.h"
15 #include "properties/SEScalarPower.h"
16 #include "properties/SEScalarHeatInductance.h"
17 #include "properties/SEScalarHeatResistance.h"
18 
19 #define CIRCUIT_PATH_TEMPLATE typename FluxScalar, typename ResistanceScalar, typename CapacitanceScalar, typename InductanceScalar, typename PotentialScalar, typename QuantityScalar
20 #define CIRCUIT_PATH_TYPES FluxScalar,ResistanceScalar,CapacitanceScalar,InductanceScalar,PotentialScalar,QuantityScalar
21 #define ELECTRICAL_CIRCUIT_PATH SEScalarElectricCurrent, SEScalarElectricResistance, SEScalarElectricCapacitance, SEScalarElectricInductance, SEScalarElectricPotential, SEScalarElectricCharge
22 #define FLUID_CIRCUIT_PATH SEScalarVolumePerTime, SEScalarFlowResistance, SEScalarFlowCompliance, SEScalarFlowInertance, SEScalarPressure, SEScalarVolume
23 #define THERMAL_CIRCUIT_PATH SEScalarPower, SEScalarHeatResistance, SEScalarHeatCapacitance, SEScalarHeatInductance, SEScalarTemperature, SEScalarEnergy
24 
25 template<CIRCUIT_PATH_TEMPLATE>
26 class SECircuitPath : public Loggable
27 {
28  friend class PBCircuit;//friend the serialization class
29  template<typename NodeType, typename PathType> friend class SECircuit;
30 protected:
32 public:
33  virtual ~SECircuitPath();
34 
35  virtual void Clear();
36 
37  virtual std::string GetName() const;
38 
41 
42  virtual bool HasFlux() const;
43  virtual FluxScalar& GetFlux();
44  virtual bool HasNextFlux() const;
45  virtual FluxScalar& GetNextFlux();
46  virtual bool HasFluxSource() const;
47  virtual FluxScalar& GetFluxSource();
48  virtual bool HasNextFluxSource() const;
49  virtual FluxScalar& GetNextFluxSource();
50  virtual bool HasFluxSourceBaseline() const;
51  virtual FluxScalar& GetFluxSourceBaseline();
52 
53  virtual bool HasResistance() const;
54  virtual ResistanceScalar& GetResistance();
55  virtual bool HasNextResistance() const;
56  virtual ResistanceScalar& GetNextResistance();
57  virtual bool HasResistanceBaseline() const;
58  virtual ResistanceScalar& GetResistanceBaseline();
59 
60  virtual bool HasCapacitance() const;
61  virtual CapacitanceScalar& GetCapacitance();
62  virtual bool HasNextCapacitance() const;
63  virtual CapacitanceScalar& GetNextCapacitance();
64  virtual bool HasCapacitanceBaseline() const;
65  virtual CapacitanceScalar& GetCapacitanceBaseline();
66 
67  virtual bool HasInductance() const;
68  virtual InductanceScalar& GetInductance();
69  virtual bool HasNextInductance() const;
70  virtual InductanceScalar& GetNextInductance();
71  virtual bool HasInductanceBaseline() const;
72  virtual InductanceScalar& GetInductanceBaseline();
73 
74  virtual bool HasPotentialSource() const;
75  virtual PotentialScalar& GetPotentialSource();
76  virtual bool HasNextPotentialSource() const;
77  virtual PotentialScalar& GetNextPotentialSource();
78  virtual bool HasPotentialSourceBaseline() const;
79  virtual PotentialScalar& GetPotentialSourceBaseline();
80  virtual bool HasValveBreakdownPotential() const;
81  virtual PotentialScalar& GetValveBreakdownPotential();
82 
83  virtual bool HasValidElements() const;
84  virtual unsigned short NumberOfElements() const { return m_NumElements; }
85  virtual unsigned short NumberOfNextElements() const { return m_NumNextElements; }
86 
87  virtual eGate GetSwitch() const;
88  virtual void SetSwitch(eGate state);
89  virtual void FlipSwitch();
90  virtual bool HasSwitch() const;
91  virtual void InvalidateSwitch();
92 
93  virtual eGate GetNextSwitch() const;
94  virtual void SetNextSwitch(eGate state);
95  virtual void FlipNextSwitch();
96  virtual bool HasNextSwitch() const;
97  virtual void InvalidateNextSwitch();
98 
99  virtual eGate GetValve() const;
100  virtual void SetValve(eGate state);
101  virtual void FlipValve();
102  virtual bool HasValve() const;
103  virtual void InvalidateValve();
104 
105  virtual eGate GetNextValve() const;
106  virtual void SetNextValve(eGate state);
107  virtual void FlipNextValve();
108  virtual bool HasNextValve() const;
109  virtual void InvalidateNextValve();
110 
111  virtual eGate GetPolarizedState() const;
112  virtual void SetPolarizedState(eGate state);
113  virtual void FlipPolarizedState();
114  virtual bool HasPolarizedState() const;
115  virtual void InvalidatePolarizedState();
116 
117  virtual eGate GetNextPolarizedState() const;
118  virtual void SetNextPolarizedState(eGate state);
119  virtual void FlipNextPolarizedState();
120  virtual bool HasNextPolarizedState() const;
121  virtual void InvalidateNextPolarizedState();
122 
123 protected:
124  std::string m_Name;
127  mutable unsigned short m_NumElements;
128  mutable unsigned short m_NumNextElements;
130  // Valves and Switches //
132  eGate m_Switch;
134  eGate m_Valve;
135  eGate m_NextValve;
138 
139  ResistanceScalar* m_Resistance;
140  ResistanceScalar* m_NextResistance;
141  ResistanceScalar* m_ResistanceBaseline;
142 
143  CapacitanceScalar* m_Capacitance;
144  CapacitanceScalar* m_NextCapacitance;
145  CapacitanceScalar* m_CapacitanceBaseline;
146 
147  InductanceScalar* m_Inductance;
148  InductanceScalar* m_NextInductance;
149  InductanceScalar* m_InductanceBaseline;
150 
151  FluxScalar* m_Flux;
152  FluxScalar* m_NextFlux;
153  FluxScalar* m_FluxSource;
154  FluxScalar* m_NextFluxSource;
155  FluxScalar* m_FluxSourceBaseline;
156 
157  PotentialScalar* m_PotentialSource;
158  PotentialScalar* m_NextPotentialSource;
159  PotentialScalar* m_PotentialSourceBaseline;
160  PotentialScalar* m_ValveBreakdownPotential;
161 };
162 #include "circuit/SECircuitPath.inl"
eGate m_Valve
Definition: SECircuitPath.h:134
InductanceScalar * m_Inductance
Definition: SECircuitPath.h:147
virtual void InvalidatePolarizedState()
virtual SECircuitNode< CIRCUIT_NODE_TYPES > & GetTargetNode() const
virtual FluxScalar & GetNextFluxSource()
virtual bool HasFluxSource() const
SECircuitNode< CIRCUIT_NODE_TYPES > & m_SourceNode
Definition: SECircuitPath.h:125
CapacitanceScalar * m_NextCapacitance
Definition: SECircuitPath.h:144
eGate m_NextPolarizedState
Definition: SECircuitPath.h:137
virtual void InvalidateNextPolarizedState()
virtual bool HasValve() const
FluxScalar * m_FluxSourceBaseline
Definition: SECircuitPath.h:155
virtual CapacitanceScalar & GetCapacitanceBaseline()
eGate m_NextValve
Definition: SECircuitPath.h:135
virtual void FlipNextValve()
virtual bool HasPotentialSource() const
virtual void SetPolarizedState(eGate state)
virtual FluxScalar & GetFluxSourceBaseline()
virtual void FlipValve()
PotentialScalar * m_PotentialSource
Definition: SECircuitPath.h:157
virtual bool HasResistanceBaseline() const
PotentialScalar * m_ValveBreakdownPotential
Definition: SECircuitPath.h:160
virtual void SetNextSwitch(eGate state)
virtual bool HasPolarizedState() const
virtual InductanceScalar & GetInductanceBaseline()
virtual eGate GetNextSwitch() const
virtual void FlipNextSwitch()
virtual bool HasFlux() const
CapacitanceScalar * m_CapacitanceBaseline
Definition: SECircuitPath.h:145
ResistanceScalar * m_NextResistance
Definition: SECircuitPath.h:140
virtual void FlipNextPolarizedState()
virtual void SetValve(eGate state)
virtual bool HasNextResistance() const
virtual bool HasNextCapacitance() const
virtual bool HasNextFluxSource() const
virtual eGate GetPolarizedState() const
virtual void InvalidateSwitch()
virtual void SetNextPolarizedState(eGate state)
SECircuitNode< CIRCUIT_NODE_TYPES > & m_TargetNode
Definition: SECircuitPath.h:126
virtual void Clear()
virtual bool HasValveBreakdownPotential() const
Definition: Logger.h:11
virtual bool HasCapacitance() const
virtual eGate GetNextValve() const
PotentialScalar * m_PotentialSourceBaseline
Definition: SECircuitPath.h:159
virtual void SetNextValve(eGate state)
virtual bool HasInductance() const
virtual ResistanceScalar & GetResistanceBaseline()
Definition: SECircuitPath.h:26
virtual bool HasNextValve() const
FluxScalar * m_FluxSource
Definition: SECircuitPath.h:153
virtual unsigned short NumberOfElements() const
Definition: SECircuitPath.h:84
Definition: SECircuitNode.h:19
virtual ResistanceScalar & GetResistance()
virtual void SetSwitch(eGate state)
virtual bool HasPotentialSourceBaseline() const
virtual unsigned short NumberOfNextElements() const
Definition: SECircuitPath.h:85
virtual eGate GetSwitch() const
FluxScalar * m_Flux
Definition: SECircuitPath.h:151
std::string m_Name
Definition: SECircuitPath.h:124
FluxScalar * m_NextFlux
Definition: SECircuitPath.h:152
virtual ResistanceScalar & GetNextResistance()
virtual bool HasSwitch() const
ResistanceScalar * m_Resistance
Definition: SECircuitPath.h:139
virtual ~SECircuitPath()
Definition: PBCircuit.h:25
virtual CapacitanceScalar & GetCapacitance()
virtual InductanceScalar & GetNextInductance()
virtual eGate GetValve() const
InductanceScalar * m_InductanceBaseline
Definition: SECircuitPath.h:149
virtual CapacitanceScalar & GetNextCapacitance()
virtual PotentialScalar & GetNextPotentialSource()
virtual bool HasNextInductance() const
CapacitanceScalar * m_Capacitance
Definition: SECircuitPath.h:143
SECircuitPath(SECircuitNode< PotentialScalar, QuantityScalar > &src, SECircuitNode< PotentialScalar, QuantityScalar > &tgt, const std::string &name)
virtual bool HasNextSwitch() const
virtual PotentialScalar & GetPotentialSource()
virtual SECircuitNode< CIRCUIT_NODE_TYPES > & GetSourceNode() const
InductanceScalar * m_NextInductance
Definition: SECircuitPath.h:148
virtual FluxScalar & GetFlux()
virtual bool HasResistance() const
virtual void FlipSwitch()
virtual PotentialScalar & GetPotentialSourceBaseline()
virtual bool HasValidElements() const
virtual bool HasNextPotentialSource() const
virtual bool HasNextFlux() const
unsigned short m_NumNextElements
Definition: SECircuitPath.h:128
virtual PotentialScalar & GetValveBreakdownPotential()
virtual void InvalidateNextValve()
FluxScalar * m_NextFluxSource
Definition: SECircuitPath.h:154
eGate m_PolarizedState
Definition: SECircuitPath.h:136
PotentialScalar * m_NextPotentialSource
Definition: SECircuitPath.h:158
virtual void FlipPolarizedState()
virtual bool HasInductanceBaseline() const
unsigned short m_NumElements
Definition: SECircuitPath.h:127
Definition: SECircuit.h:12
virtual bool HasNextPolarizedState() const
virtual void InvalidateNextSwitch()
virtual eGate GetNextPolarizedState() const
eGate m_Switch
Definition: SECircuitPath.h:132
virtual std::string GetName() const
virtual bool HasCapacitanceBaseline() const
virtual InductanceScalar & GetInductance()
eGate m_NextSwitch
Definition: SECircuitPath.h:133
virtual FluxScalar & GetFluxSource()
virtual FluxScalar & GetNextFlux()
virtual void InvalidateValve()
virtual bool HasFluxSourceBaseline() const
ResistanceScalar * m_ResistanceBaseline
Definition: SECircuitPath.h:141