Skip to main content

cimstructs/
GovSteamIEEE1.rs

1/// IEEE steam turbine governor model. Reference: IEEE Transactions on Power Apparatus and Systems, November/December 1973, Volume PAS-92, Number 6, Dynamic Models for Steam and Hydro Turbines in Power System Studies, page 1904.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct GovSteamIEEE1 {
4    #[serde(flatten)]
5    pub base: super::TurbineGovernorDynamics,
6    /// Governor gain (reciprocal of droop) (K) (> 0). Typical value = 25.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub k: Option<f64>,
9    /// Fraction of HP shaft power after first boiler pass (K1). Typical value = 0,2.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub k1: Option<f64>,
12    /// Fraction of LP shaft power after first boiler pass (K2). Typical value = 0.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub k2: Option<f64>,
15    /// Fraction of HP shaft power after second boiler pass (K3). Typical value = 0,3.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub k3: Option<f64>,
18    /// Fraction of LP shaft power after second boiler pass (K4). Typical value = 0.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub k4: Option<f64>,
21    /// Fraction of HP shaft power after third boiler pass (K5). Typical value = 0,5.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub k5: Option<f64>,
24    /// Fraction of LP shaft power after third boiler pass (K6). Typical value = 0.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub k6: Option<f64>,
27    /// Fraction of HP shaft power after fourth boiler pass (K7). Typical value = 0.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub k7: Option<f64>,
30    /// Fraction of LP shaft power after fourth boiler pass (K8). Typical value = 0.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub k8: Option<f64>,
33    /// Base for power values (MWbase) (> 0). Unit = MW.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub mwbase: Option<f64>,
36    /// Maximum valve opening (Pmax) (> GovSteamIEEE1.pmin). Typical value = 1.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub pmax: Option<f64>,
39    /// Minimum valve opening (Pmin) (>= 0 and < GovSteamIEEE1.pmax). Typical value = 0.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub pmin: Option<f64>,
42    /// Governor lag time constant (T1) (>= 0). Typical value = 0.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub t1: Option<f64>,
45    /// Governor lead time constant (T2) (>= 0). Typical value = 0.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub t2: Option<f64>,
48    /// Valve positioner time constant (T3) (> 0). Typical value = 0,1.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub t3: Option<f64>,
51    /// Inlet piping/steam bowl time constant (T4) (>= 0). Typical value = 0,3.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub t4: Option<f64>,
54    /// Time constant of second boiler pass (T5) (>= 0). Typical value = 5.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub t5: Option<f64>,
57    /// Time constant of third boiler pass (T6) (>= 0). Typical value = 0,5.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub t6: Option<f64>,
60    /// Time constant of fourth boiler pass (T7) (>= 0). Typical value = 0.
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub t7: Option<f64>,
63    /// Maximum valve closing velocity (Uc) (< 0). Unit = PU / s. Typical value = -10.
64    #[serde(skip_serializing_if = "Option::is_none")]
65    pub uc: Option<f64>,
66    /// Maximum valve opening velocity (Uo) (> 0). Unit = PU / s. Typical value = 1.
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub uo: Option<f64>,
69}
70impl crate::base::CimElement for GovSteamIEEE1 {
71    fn mrid(&self) -> &str { &self.base.base.base.id }
72    fn type_name(&self) -> &'static str { "GovSteamIEEE1" }
73    fn as_any(&self) -> &dyn std::any::Any { self }
74    fn to_json_value(&self) -> serde_json::Value {
75        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
76    }
77    fn to_block(&self) -> crate::base::RdfBlock {
78        let mut block = self.base.to_block();
79        block.type_name = "GovSteamIEEE1".to_string();
80        if let Some(v) = self.k {
81            block.fields.insert("GovSteamIEEE1.k".into(), crate::base::FieldValue::Text(v.to_string()));
82        }
83        if let Some(v) = self.k1 {
84            block.fields.insert("GovSteamIEEE1.k1".into(), crate::base::FieldValue::Text(v.to_string()));
85        }
86        if let Some(v) = self.k2 {
87            block.fields.insert("GovSteamIEEE1.k2".into(), crate::base::FieldValue::Text(v.to_string()));
88        }
89        if let Some(v) = self.k3 {
90            block.fields.insert("GovSteamIEEE1.k3".into(), crate::base::FieldValue::Text(v.to_string()));
91        }
92        if let Some(v) = self.k4 {
93            block.fields.insert("GovSteamIEEE1.k4".into(), crate::base::FieldValue::Text(v.to_string()));
94        }
95        if let Some(v) = self.k5 {
96            block.fields.insert("GovSteamIEEE1.k5".into(), crate::base::FieldValue::Text(v.to_string()));
97        }
98        if let Some(v) = self.k6 {
99            block.fields.insert("GovSteamIEEE1.k6".into(), crate::base::FieldValue::Text(v.to_string()));
100        }
101        if let Some(v) = self.k7 {
102            block.fields.insert("GovSteamIEEE1.k7".into(), crate::base::FieldValue::Text(v.to_string()));
103        }
104        if let Some(v) = self.k8 {
105            block.fields.insert("GovSteamIEEE1.k8".into(), crate::base::FieldValue::Text(v.to_string()));
106        }
107        if let Some(v) = self.mwbase {
108            block.fields.insert("GovSteamIEEE1.mwbase".into(), crate::base::FieldValue::Text(v.to_string()));
109        }
110        if let Some(v) = self.pmax {
111            block.fields.insert("GovSteamIEEE1.pmax".into(), crate::base::FieldValue::Text(v.to_string()));
112        }
113        if let Some(v) = self.pmin {
114            block.fields.insert("GovSteamIEEE1.pmin".into(), crate::base::FieldValue::Text(v.to_string()));
115        }
116        if let Some(v) = self.t1 {
117            block.fields.insert("GovSteamIEEE1.t1".into(), crate::base::FieldValue::Text(v.to_string()));
118        }
119        if let Some(v) = self.t2 {
120            block.fields.insert("GovSteamIEEE1.t2".into(), crate::base::FieldValue::Text(v.to_string()));
121        }
122        if let Some(v) = self.t3 {
123            block.fields.insert("GovSteamIEEE1.t3".into(), crate::base::FieldValue::Text(v.to_string()));
124        }
125        if let Some(v) = self.t4 {
126            block.fields.insert("GovSteamIEEE1.t4".into(), crate::base::FieldValue::Text(v.to_string()));
127        }
128        if let Some(v) = self.t5 {
129            block.fields.insert("GovSteamIEEE1.t5".into(), crate::base::FieldValue::Text(v.to_string()));
130        }
131        if let Some(v) = self.t6 {
132            block.fields.insert("GovSteamIEEE1.t6".into(), crate::base::FieldValue::Text(v.to_string()));
133        }
134        if let Some(v) = self.t7 {
135            block.fields.insert("GovSteamIEEE1.t7".into(), crate::base::FieldValue::Text(v.to_string()));
136        }
137        if let Some(v) = self.uc {
138            block.fields.insert("GovSteamIEEE1.uc".into(), crate::base::FieldValue::Text(v.to_string()));
139        }
140        if let Some(v) = self.uo {
141            block.fields.insert("GovSteamIEEE1.uo".into(), crate::base::FieldValue::Text(v.to_string()));
142        }
143        block
144    }
145}
146
147impl GovSteamIEEE1 {
148    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
149        let mut obj = Self::default();
150        obj.base.base.base.id.clone_from(&b.mrid);
151        for (key, val) in &b.fields {
152            match key.as_str() {
153                "GovSteamIEEE1.k" => {
154                    match val {
155                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k = Some(v); } }
156                        crate::base::FieldValue::TextList(svs) => {
157                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k = Some(v); } }
158                        }
159                        _ => {}
160                    }
161                }
162                "GovSteamIEEE1.k1" => {
163                    match val {
164                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k1 = Some(v); } }
165                        crate::base::FieldValue::TextList(svs) => {
166                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k1 = Some(v); } }
167                        }
168                        _ => {}
169                    }
170                }
171                "GovSteamIEEE1.k2" => {
172                    match val {
173                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k2 = Some(v); } }
174                        crate::base::FieldValue::TextList(svs) => {
175                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k2 = Some(v); } }
176                        }
177                        _ => {}
178                    }
179                }
180                "GovSteamIEEE1.k3" => {
181                    match val {
182                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k3 = Some(v); } }
183                        crate::base::FieldValue::TextList(svs) => {
184                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k3 = Some(v); } }
185                        }
186                        _ => {}
187                    }
188                }
189                "GovSteamIEEE1.k4" => {
190                    match val {
191                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k4 = Some(v); } }
192                        crate::base::FieldValue::TextList(svs) => {
193                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k4 = Some(v); } }
194                        }
195                        _ => {}
196                    }
197                }
198                "GovSteamIEEE1.k5" => {
199                    match val {
200                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k5 = Some(v); } }
201                        crate::base::FieldValue::TextList(svs) => {
202                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k5 = Some(v); } }
203                        }
204                        _ => {}
205                    }
206                }
207                "GovSteamIEEE1.k6" => {
208                    match val {
209                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k6 = Some(v); } }
210                        crate::base::FieldValue::TextList(svs) => {
211                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k6 = Some(v); } }
212                        }
213                        _ => {}
214                    }
215                }
216                "GovSteamIEEE1.k7" => {
217                    match val {
218                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k7 = Some(v); } }
219                        crate::base::FieldValue::TextList(svs) => {
220                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k7 = Some(v); } }
221                        }
222                        _ => {}
223                    }
224                }
225                "GovSteamIEEE1.k8" => {
226                    match val {
227                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k8 = Some(v); } }
228                        crate::base::FieldValue::TextList(svs) => {
229                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k8 = Some(v); } }
230                        }
231                        _ => {}
232                    }
233                }
234                "GovSteamIEEE1.mwbase" => {
235                    match val {
236                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.mwbase = Some(v); } }
237                        crate::base::FieldValue::TextList(svs) => {
238                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.mwbase = Some(v); } }
239                        }
240                        _ => {}
241                    }
242                }
243                "GovSteamIEEE1.pmax" => {
244                    match val {
245                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.pmax = Some(v); } }
246                        crate::base::FieldValue::TextList(svs) => {
247                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.pmax = Some(v); } }
248                        }
249                        _ => {}
250                    }
251                }
252                "GovSteamIEEE1.pmin" => {
253                    match val {
254                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.pmin = Some(v); } }
255                        crate::base::FieldValue::TextList(svs) => {
256                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.pmin = Some(v); } }
257                        }
258                        _ => {}
259                    }
260                }
261                "GovSteamIEEE1.t1" => {
262                    match val {
263                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t1 = Some(v); } }
264                        crate::base::FieldValue::TextList(svs) => {
265                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t1 = Some(v); } }
266                        }
267                        _ => {}
268                    }
269                }
270                "GovSteamIEEE1.t2" => {
271                    match val {
272                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t2 = Some(v); } }
273                        crate::base::FieldValue::TextList(svs) => {
274                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t2 = Some(v); } }
275                        }
276                        _ => {}
277                    }
278                }
279                "GovSteamIEEE1.t3" => {
280                    match val {
281                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t3 = Some(v); } }
282                        crate::base::FieldValue::TextList(svs) => {
283                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t3 = Some(v); } }
284                        }
285                        _ => {}
286                    }
287                }
288                "GovSteamIEEE1.t4" => {
289                    match val {
290                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t4 = Some(v); } }
291                        crate::base::FieldValue::TextList(svs) => {
292                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t4 = Some(v); } }
293                        }
294                        _ => {}
295                    }
296                }
297                "GovSteamIEEE1.t5" => {
298                    match val {
299                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t5 = Some(v); } }
300                        crate::base::FieldValue::TextList(svs) => {
301                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t5 = Some(v); } }
302                        }
303                        _ => {}
304                    }
305                }
306                "GovSteamIEEE1.t6" => {
307                    match val {
308                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t6 = Some(v); } }
309                        crate::base::FieldValue::TextList(svs) => {
310                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t6 = Some(v); } }
311                        }
312                        _ => {}
313                    }
314                }
315                "GovSteamIEEE1.t7" => {
316                    match val {
317                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.t7 = Some(v); } }
318                        crate::base::FieldValue::TextList(svs) => {
319                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.t7 = Some(v); } }
320                        }
321                        _ => {}
322                    }
323                }
324                "GovSteamIEEE1.uc" => {
325                    match val {
326                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.uc = Some(v); } }
327                        crate::base::FieldValue::TextList(svs) => {
328                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.uc = Some(v); } }
329                        }
330                        _ => {}
331                    }
332                }
333                "GovSteamIEEE1.uo" => {
334                    match val {
335                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.uo = Some(v); } }
336                        crate::base::FieldValue::TextList(svs) => {
337                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.uo = Some(v); } }
338                        }
339                        _ => {}
340                    }
341                }
342                "TurbineGovernorDynamics.AsynchronousMachineDynamics" => {
343                    if let crate::base::FieldValue::Resource(sv) = val {
344                        obj.base.asynchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
345                    }
346                }
347                "TurbineGovernorDynamics.SynchronousMachineDynamics" => {
348                    if let crate::base::FieldValue::Resource(sv) = val {
349                        obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
350                    }
351                }
352                "DynamicsFunctionBlock.enabled" => {
353                    match val {
354                        crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
355                        crate::base::FieldValue::TextList(svs) => {
356                            if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
357                        }
358                        _ => {}
359                    }
360                }
361                "IdentifiedObject.description" => {
362                    match val {
363                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
364                        crate::base::FieldValue::TextList(svs) => {
365                            if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
366                        }
367                        _ => {}
368                    }
369                }
370                "IdentifiedObject.energyIdentCodeEic" => {
371                    match val {
372                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
373                        crate::base::FieldValue::TextList(svs) => {
374                            if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
375                        }
376                        _ => {}
377                    }
378                }
379                "IdentifiedObject.mRID" => {
380                    match val {
381                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
382                        crate::base::FieldValue::TextList(svs) => {
383                            if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
384                        }
385                        _ => {}
386                    }
387                }
388                "IdentifiedObject.name" => {
389                    match val {
390                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
391                        crate::base::FieldValue::TextList(svs) => {
392                            if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
393                        }
394                        _ => {}
395                    }
396                }
397                "IdentifiedObject.shortName" => {
398                    match val {
399                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
400                        crate::base::FieldValue::TextList(svs) => {
401                            if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
402                        }
403                        _ => {}
404                    }
405                }
406                _ => {}
407            }
408        }
409        obj
410    }
411}