Skip to main content

cimstructs/
GovSteamCC.rs

1/// Cross compound turbine governor. Unlike tandem compound units, cross compound units are not on the same shaft.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct GovSteamCC {
4    #[serde(flatten)]
5    pub base: super::CrossCompoundTurbineGovernorDynamics,
6    /// HP damping factor (Dhp). Typical value = 0.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub dhp: Option<f64>,
9    /// LP damping factor (Dlp). Typical value = 0.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub dlp: Option<f64>,
12    /// Fraction of HP power ahead of reheater (Fhp). Typical value = 0,3.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub fhp: Option<f64>,
15    /// Fraction of LP power ahead of reheater (Flp). Typical value = 0,7.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub flp: Option<f64>,
18    /// Base for power values (MWbase) (> 0). Unit = MW.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub mwbase: Option<f64>,
21    /// Maximum HP value position (Pmaxhp). Typical value = 1.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub pmaxhp: Option<f64>,
24    /// Maximum LP value position (Pmaxlp). Typical value = 1.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub pmaxlp: Option<f64>,
27    /// HP governor droop (Rhp) (> 0). Typical value = 0,05.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub rhp: Option<f64>,
30    /// LP governor droop (Rlp) (> 0). Typical value = 0,05.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub rlp: Option<f64>,
33    /// HP governor time constant (T1hp) (>= 0). Typical value = 0,1.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub t1hp: Option<f64>,
36    /// LP governor time constant (T1lp) (>= 0). Typical value = 0,1.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub t1lp: Option<f64>,
39    /// HP turbine time constant (T3hp) (>= 0). Typical value = 0,1.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub t3hp: Option<f64>,
42    /// LP turbine time constant (T3lp) (>= 0). Typical value = 0,1.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub t3lp: Option<f64>,
45    /// HP turbine time constant (T4hp) (>= 0). Typical value = 0,1.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub t4hp: Option<f64>,
48    /// LP turbine time constant (T4lp) (>= 0). Typical value = 0,1.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub t4lp: Option<f64>,
51    /// HP reheater time constant (T5hp) (>= 0). Typical value = 10.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub t5hp: Option<f64>,
54    /// LP reheater time constant (T5lp) (>= 0). Typical value = 10.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub t5lp: Option<f64>,
57}
58impl crate::base::CimElement for GovSteamCC {
59    fn mrid(&self) -> &str { &self.base.base.base.id }
60    fn type_name(&self) -> &'static str { "GovSteamCC" }
61    fn as_any(&self) -> &dyn std::any::Any { self }
62    fn to_json_value(&self) -> serde_json::Value {
63        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
64    }
65    fn to_block(&self) -> crate::base::RdfBlock {
66        let mut block = self.base.to_block();
67        block.type_name = "GovSteamCC".to_string();
68        if let Some(v) = self.dhp {
69            block.fields.insert("GovSteamCC.dhp".into(), crate::base::FieldValue::Text(v.to_string()));
70        }
71        if let Some(v) = self.dlp {
72            block.fields.insert("GovSteamCC.dlp".into(), crate::base::FieldValue::Text(v.to_string()));
73        }
74        if let Some(v) = self.fhp {
75            block.fields.insert("GovSteamCC.fhp".into(), crate::base::FieldValue::Text(v.to_string()));
76        }
77        if let Some(v) = self.flp {
78            block.fields.insert("GovSteamCC.flp".into(), crate::base::FieldValue::Text(v.to_string()));
79        }
80        if let Some(v) = self.mwbase {
81            block.fields.insert("GovSteamCC.mwbase".into(), crate::base::FieldValue::Text(v.to_string()));
82        }
83        if let Some(v) = self.pmaxhp {
84            block.fields.insert("GovSteamCC.pmaxhp".into(), crate::base::FieldValue::Text(v.to_string()));
85        }
86        if let Some(v) = self.pmaxlp {
87            block.fields.insert("GovSteamCC.pmaxlp".into(), crate::base::FieldValue::Text(v.to_string()));
88        }
89        if let Some(v) = self.rhp {
90            block.fields.insert("GovSteamCC.rhp".into(), crate::base::FieldValue::Text(v.to_string()));
91        }
92        if let Some(v) = self.rlp {
93            block.fields.insert("GovSteamCC.rlp".into(), crate::base::FieldValue::Text(v.to_string()));
94        }
95        if let Some(v) = self.t1hp {
96            block.fields.insert("GovSteamCC.t1hp".into(), crate::base::FieldValue::Text(v.to_string()));
97        }
98        if let Some(v) = self.t1lp {
99            block.fields.insert("GovSteamCC.t1lp".into(), crate::base::FieldValue::Text(v.to_string()));
100        }
101        if let Some(v) = self.t3hp {
102            block.fields.insert("GovSteamCC.t3hp".into(), crate::base::FieldValue::Text(v.to_string()));
103        }
104        if let Some(v) = self.t3lp {
105            block.fields.insert("GovSteamCC.t3lp".into(), crate::base::FieldValue::Text(v.to_string()));
106        }
107        if let Some(v) = self.t4hp {
108            block.fields.insert("GovSteamCC.t4hp".into(), crate::base::FieldValue::Text(v.to_string()));
109        }
110        if let Some(v) = self.t4lp {
111            block.fields.insert("GovSteamCC.t4lp".into(), crate::base::FieldValue::Text(v.to_string()));
112        }
113        if let Some(v) = self.t5hp {
114            block.fields.insert("GovSteamCC.t5hp".into(), crate::base::FieldValue::Text(v.to_string()));
115        }
116        if let Some(v) = self.t5lp {
117            block.fields.insert("GovSteamCC.t5lp".into(), crate::base::FieldValue::Text(v.to_string()));
118        }
119        block
120    }
121}
122
123impl GovSteamCC {
124    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
125        let mut obj = Self::default();
126        obj.base.base.base.id.clone_from(&b.mrid);
127        for (key, val) in &b.fields {
128            match key.as_str() {
129                "GovSteamCC.dhp" => {
130                    match val {
131                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.dhp = Some(v); } }
132                        crate::base::FieldValue::TextList(svs) => {
133                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.dhp = Some(v); } }
134                        }
135                        _ => {}
136                    }
137                }
138                "GovSteamCC.dlp" => {
139                    match val {
140                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.dlp = Some(v); } }
141                        crate::base::FieldValue::TextList(svs) => {
142                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.dlp = Some(v); } }
143                        }
144                        _ => {}
145                    }
146                }
147                "GovSteamCC.fhp" => {
148                    match val {
149                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.fhp = Some(v); } }
150                        crate::base::FieldValue::TextList(svs) => {
151                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.fhp = Some(v); } }
152                        }
153                        _ => {}
154                    }
155                }
156                "GovSteamCC.flp" => {
157                    match val {
158                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.flp = Some(v); } }
159                        crate::base::FieldValue::TextList(svs) => {
160                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.flp = Some(v); } }
161                        }
162                        _ => {}
163                    }
164                }
165                "GovSteamCC.mwbase" => {
166                    match val {
167                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.mwbase = Some(v); } }
168                        crate::base::FieldValue::TextList(svs) => {
169                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.mwbase = Some(v); } }
170                        }
171                        _ => {}
172                    }
173                }
174                "GovSteamCC.pmaxhp" => {
175                    match val {
176                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.pmaxhp = Some(v); } }
177                        crate::base::FieldValue::TextList(svs) => {
178                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.pmaxhp = Some(v); } }
179                        }
180                        _ => {}
181                    }
182                }
183                "GovSteamCC.pmaxlp" => {
184                    match val {
185                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.pmaxlp = Some(v); } }
186                        crate::base::FieldValue::TextList(svs) => {
187                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.pmaxlp = Some(v); } }
188                        }
189                        _ => {}
190                    }
191                }
192                "GovSteamCC.rhp" => {
193                    match val {
194                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.rhp = Some(v); } }
195                        crate::base::FieldValue::TextList(svs) => {
196                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.rhp = Some(v); } }
197                        }
198                        _ => {}
199                    }
200                }
201                "GovSteamCC.rlp" => {
202                    match val {
203                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.rlp = Some(v); } }
204                        crate::base::FieldValue::TextList(svs) => {
205                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.rlp = Some(v); } }
206                        }
207                        _ => {}
208                    }
209                }
210                "GovSteamCC.t1hp" => {
211                    match val {
212                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t1hp = Some(v); } }
213                        crate::base::FieldValue::TextList(svs) => {
214                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t1hp = Some(v); } }
215                        }
216                        _ => {}
217                    }
218                }
219                "GovSteamCC.t1lp" => {
220                    match val {
221                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t1lp = Some(v); } }
222                        crate::base::FieldValue::TextList(svs) => {
223                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t1lp = Some(v); } }
224                        }
225                        _ => {}
226                    }
227                }
228                "GovSteamCC.t3hp" => {
229                    match val {
230                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t3hp = Some(v); } }
231                        crate::base::FieldValue::TextList(svs) => {
232                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t3hp = Some(v); } }
233                        }
234                        _ => {}
235                    }
236                }
237                "GovSteamCC.t3lp" => {
238                    match val {
239                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t3lp = Some(v); } }
240                        crate::base::FieldValue::TextList(svs) => {
241                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t3lp = Some(v); } }
242                        }
243                        _ => {}
244                    }
245                }
246                "GovSteamCC.t4hp" => {
247                    match val {
248                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t4hp = Some(v); } }
249                        crate::base::FieldValue::TextList(svs) => {
250                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t4hp = Some(v); } }
251                        }
252                        _ => {}
253                    }
254                }
255                "GovSteamCC.t4lp" => {
256                    match val {
257                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t4lp = Some(v); } }
258                        crate::base::FieldValue::TextList(svs) => {
259                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t4lp = Some(v); } }
260                        }
261                        _ => {}
262                    }
263                }
264                "GovSteamCC.t5hp" => {
265                    match val {
266                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t5hp = Some(v); } }
267                        crate::base::FieldValue::TextList(svs) => {
268                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t5hp = Some(v); } }
269                        }
270                        _ => {}
271                    }
272                }
273                "GovSteamCC.t5lp" => {
274                    match val {
275                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t5lp = Some(v); } }
276                        crate::base::FieldValue::TextList(svs) => {
277                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t5lp = Some(v); } }
278                        }
279                        _ => {}
280                    }
281                }
282                "CrossCompoundTurbineGovernorDynamics.HighPressureSynchronousMachineDynamics" => {
283                    if let crate::base::FieldValue::Resource(sv) = val {
284                        obj.base.high_pressure_synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
285                    }
286                }
287                "CrossCompoundTurbineGovernorDynamics.LowPressureSynchronousMachineDynamics" => {
288                    if let crate::base::FieldValue::Resource(sv) = val {
289                        obj.base.low_pressure_synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
290                    }
291                }
292                "DynamicsFunctionBlock.enabled" => {
293                    match val {
294                        crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
295                        crate::base::FieldValue::TextList(svs) => {
296                            if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
297                        }
298                        _ => {}
299                    }
300                }
301                "IdentifiedObject.description" => {
302                    match val {
303                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
304                        crate::base::FieldValue::TextList(svs) => {
305                            if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
306                        }
307                        _ => {}
308                    }
309                }
310                "IdentifiedObject.energyIdentCodeEic" => {
311                    match val {
312                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
313                        crate::base::FieldValue::TextList(svs) => {
314                            if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
315                        }
316                        _ => {}
317                    }
318                }
319                "IdentifiedObject.mRID" => {
320                    match val {
321                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
322                        crate::base::FieldValue::TextList(svs) => {
323                            if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
324                        }
325                        _ => {}
326                    }
327                }
328                "IdentifiedObject.name" => {
329                    match val {
330                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
331                        crate::base::FieldValue::TextList(svs) => {
332                            if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
333                        }
334                        _ => {}
335                    }
336                }
337                "IdentifiedObject.shortName" => {
338                    match val {
339                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
340                        crate::base::FieldValue::TextList(svs) => {
341                            if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
342                        }
343                        _ => {}
344                    }
345                }
346                _ => {}
347            }
348        }
349        obj
350    }
351}