Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
structs.hpp
Go to the documentation of this file.
1#ifndef IV_SRC_MODEL_CONTROL_STRUCTS_HPP_
2#define IV_SRC_MODEL_CONTROL_STRUCTS_HPP_
3
6
7#include <memory>
8
9namespace iv::model::control
10{
11
12namespace valve
13{
14
16{
17 bool load(const file::xml::node &nodeValve);
18 bool save(file::xml::node &nodeValve) const;
19
20 std::weak_ptr<iv::channels::AbstractChannel> chFeedbackOP {};
21 std::weak_ptr<iv::channels::AbstractChannel> chFeedbackCL {};
22 std::weak_ptr<iv::channels::AbstractChannel> chOutputOP {};
23 std::weak_ptr<iv::channels::AbstractChannel> chOutputCL {};
24
25 std::weak_ptr<iv::channels::AbstractChannel> chCmdOP {};
26 std::weak_ptr<iv::channels::AbstractChannel> chCmdCL {};
27 std::weak_ptr<iv::channels::AbstractChannel> chCmdReset {};
28 std::weak_ptr<iv::channels::AbstractChannel> chTrip {};
29
31 {
32 if (chFeedbackOP.expired() or chFeedbackCL.expired() or chOutputOP.expired())
33 {
34 return false;
35 }
36
37 if (valveType == valve::eValveType::Double and chOutputCL.expired())
38 {
39 return false;
40 }
41
42 return true;
43 }
44
46 {
47 if (chFeedbackOP.expired() or chFeedbackCL.expired() or chOutputOP.expired() or chCmdOP.expired() or
48 chCmdCL.expired() or chCmdReset.expired() or chTrip.expired())
49 {
50 return false;
51 }
52
53 if (valveType == valve::eValveType::Double and chOutputCL.expired())
54 {
55 return false;
56 }
57
58 return true;
59 }
60
61 struct Sections
62 {
63 static constexpr std::string_view channelFeedbackOP {"ChannelFeedbackOP"};
64 static constexpr std::string_view channelFeedbackCL {"ChannelFeedbackCL"};
65 static constexpr std::string_view channelOutputOP {"ChannelOutputOP"};
66 static constexpr std::string_view channelOutputCL {"ChannelOutputCL"};
67
68 static constexpr std::string_view channelCmdOP {"ChannelCmdOP"};
69 static constexpr std::string_view channelCmdCL {"ChannelCmdCL"};
70 static constexpr std::string_view channelCmdReset {"ChannelCmdReset"};
71 static constexpr std::string_view channelTrip {"ChannelTrip"};
72 };
73 struct Keys
74 {
75 static constexpr std::string_view channelId {"ChannelId"};
76 };
78 {
79 static constexpr std::string string {};
80 static constexpr iv::types::pms::elementId id {0};
81 };
82 struct Constants
83 {
84 static constexpr std::string feedbackOPName {"OF"};
85 static constexpr std::string feedbackCLName {"CF"};
86 static constexpr std::string outputOPName {"OO"};
87 static constexpr std::string outputCLName {"CO"};
88
89 static constexpr std::string cmdOPName {"OC"};
90 static constexpr std::string cmdCLName {"CC"};
91 static constexpr std::string cmdResetName {"RS"};
92 static constexpr std::string tripName {"TR"};
93 };
94};
95
96}// namespace valve
97
98namespace damper
99{
100
102{
103 bool load(const file::xml::node &nodeDamper);
104 bool save(file::xml::node &nodeDamper) const;
105
106 std::weak_ptr<iv::channels::AbstractChannel> chFeedbackOP {};
107 std::weak_ptr<iv::channels::AbstractChannel> chFeedbackCL {};
108 std::weak_ptr<iv::channels::AbstractChannel> chOutputOP {};
109 std::weak_ptr<iv::channels::AbstractChannel> chOutputCL {};
110
111 std::weak_ptr<iv::channels::AbstractChannel> chCmdOP {};
112 std::weak_ptr<iv::channels::AbstractChannel> chCmdCL {};
113 std::weak_ptr<iv::channels::AbstractChannel> chCmdReset {};
114 std::weak_ptr<iv::channels::AbstractChannel> chTrip {};
115
117 {
118 if (chFeedbackOP.expired() or chFeedbackCL.expired() or chOutputOP.expired())
119 {
120 return false;
121 }
122
123 if (damperType == damper::eDamperType::Double and chOutputCL.expired())
124 {
125 return false;
126 }
127
128 return true;
129 }
130
132 {
133 if (chFeedbackOP.expired() or chFeedbackCL.expired() or chOutputOP.expired() or chCmdOP.expired() or
134 chCmdCL.expired() or chCmdReset.expired() or chTrip.expired())
135 {
136 return false;
137 }
138
139 if (damperType == damper::eDamperType::Double and chOutputCL.expired())
140 {
141 return false;
142 }
143
144 return true;
145 }
146
147 struct Sections
148 {
149 static constexpr std::string_view channelFeedbackOP {"ChannelFeedbackOP"};
150 static constexpr std::string_view channelFeedbackCL {"ChannelFeedbackCL"};
151 static constexpr std::string_view channelOutputOP {"ChannelOutputOP"};
152 static constexpr std::string_view channelOutputCL {"ChannelOutputCL"};
153
154 static constexpr std::string_view channelCmdOP {"ChannelCmdOP"};
155 static constexpr std::string_view channelCmdCL {"ChannelCmdCL"};
156 static constexpr std::string_view channelCmdReset {"ChannelCmdReset"};
157 static constexpr std::string_view channelTrip {"ChannelTrip"};
158 };
159 struct Keys
160 {
161 static constexpr std::string_view channelId {"ChannelId"};
162 };
164 {
165 static constexpr std::string string {};
166 static constexpr iv::types::pms::elementId id {0};
167 };
169 {
170 static constexpr std::string feedbackOPName {"OF"};
171 static constexpr std::string feedbackCLName {"CF"};
172 static constexpr std::string outputOPName {"OO"};
173 static constexpr std::string outputCLName {"CO"};
174
175 static constexpr std::string cmdOPName {"OC"};
176 static constexpr std::string cmdCLName {"CC"};
177 static constexpr std::string cmdResetName {"RS"};
178 static constexpr std::string tripName {"TR"};
179 };
180};
181
182}// namespace damper
183
184}// namespace iv::model::control
185
186#endif//IV_SRC_MODEL_CONTROL_STRUCTS_HPP_
Definition xmlFile.hpp:15
eDamperType
Definition enums.hpp:89
eValveType
Definition enums.hpp:71
Definition ControlManager.cpp:4
uint16_t elementId
Definition types.hpp:96
static constexpr std::string outputOPName
Definition structs.hpp:172
static constexpr std::string outputCLName
Definition structs.hpp:173
static constexpr std::string cmdResetName
Definition structs.hpp:177
static constexpr std::string cmdOPName
Definition structs.hpp:175
static constexpr std::string feedbackOPName
Definition structs.hpp:170
static constexpr std::string tripName
Definition structs.hpp:178
static constexpr std::string feedbackCLName
Definition structs.hpp:171
static constexpr std::string cmdCLName
Definition structs.hpp:176
static constexpr std::string_view channelId
Definition structs.hpp:161
static constexpr std::string_view channelTrip
Definition structs.hpp:157
static constexpr std::string_view channelCmdCL
Definition structs.hpp:155
static constexpr std::string_view channelOutputOP
Definition structs.hpp:151
static constexpr std::string_view channelOutputCL
Definition structs.hpp:152
static constexpr std::string_view channelCmdOP
Definition structs.hpp:154
static constexpr std::string_view channelFeedbackCL
Definition structs.hpp:150
static constexpr std::string_view channelFeedbackOP
Definition structs.hpp:149
static constexpr std::string_view channelCmdReset
Definition structs.hpp:156
std::weak_ptr< iv::channels::AbstractChannel > chOutputOP
Definition structs.hpp:108
std::weak_ptr< iv::channels::AbstractChannel > chFeedbackOP
Definition structs.hpp:106
bool load(const file::xml::node &nodeDamper)
Definition structs.cpp:107
bool save(file::xml::node &nodeDamper) const
Definition structs.cpp:121
std::weak_ptr< iv::channels::AbstractChannel > chTrip
Definition structs.hpp:114
std::weak_ptr< iv::channels::AbstractChannel > chCmdCL
Definition structs.hpp:112
std::weak_ptr< iv::channels::AbstractChannel > chCmdOP
Definition structs.hpp:111
std::weak_ptr< iv::channels::AbstractChannel > chFeedbackCL
Definition structs.hpp:107
bool isValid(iv::model::control::damper::eDamperType damperType)
Definition structs.hpp:116
std::weak_ptr< iv::channels::AbstractChannel > chOutputCL
Definition structs.hpp:109
bool isAllLinked(iv::model::control::damper::eDamperType damperType)
Definition structs.hpp:131
std::weak_ptr< iv::channels::AbstractChannel > chCmdReset
Definition structs.hpp:113
static constexpr std::string outputCLName
Definition structs.hpp:87
static constexpr std::string cmdOPName
Definition structs.hpp:89
static constexpr std::string tripName
Definition structs.hpp:92
static constexpr std::string cmdResetName
Definition structs.hpp:91
static constexpr std::string feedbackOPName
Definition structs.hpp:84
static constexpr std::string cmdCLName
Definition structs.hpp:90
static constexpr std::string outputOPName
Definition structs.hpp:86
static constexpr std::string feedbackCLName
Definition structs.hpp:85
static constexpr std::string_view channelId
Definition structs.hpp:75
static constexpr std::string_view channelCmdOP
Definition structs.hpp:68
static constexpr std::string_view channelCmdCL
Definition structs.hpp:69
static constexpr std::string_view channelCmdReset
Definition structs.hpp:70
static constexpr std::string_view channelTrip
Definition structs.hpp:71
static constexpr std::string_view channelFeedbackOP
Definition structs.hpp:63
static constexpr std::string_view channelOutputCL
Definition structs.hpp:66
static constexpr std::string_view channelFeedbackCL
Definition structs.hpp:64
static constexpr std::string_view channelOutputOP
Definition structs.hpp:65
std::weak_ptr< iv::channels::AbstractChannel > chCmdReset
Definition structs.hpp:27
bool save(file::xml::node &nodeValve) const
Definition structs.cpp:37
std::weak_ptr< iv::channels::AbstractChannel > chOutputCL
Definition structs.hpp:23
std::weak_ptr< iv::channels::AbstractChannel > chFeedbackOP
Definition structs.hpp:20
std::weak_ptr< iv::channels::AbstractChannel > chCmdOP
Definition structs.hpp:25
bool isValid(iv::model::control::valve::eValveType valveType)
Definition structs.hpp:30
std::weak_ptr< iv::channels::AbstractChannel > chCmdCL
Definition structs.hpp:26
std::weak_ptr< iv::channels::AbstractChannel > chTrip
Definition structs.hpp:28
bool load(const file::xml::node &nodeValve)
Definition structs.cpp:23
std::weak_ptr< iv::channels::AbstractChannel > chOutputOP
Definition structs.hpp:22
bool isAllLinked(iv::model::control::valve::eValveType valveType)
Definition structs.hpp:45
std::weak_ptr< iv::channels::AbstractChannel > chFeedbackCL
Definition structs.hpp:21