Skip to main content

cimstructs/
ExcIEEEST1A.rs

1/// IEEE 421.5-2005 type ST1A model. This model represents systems in which excitation power is supplied through a transformer from the generator terminals (or the unit’s auxiliary bus) and is regulated by a controlled rectifier. The maximum exciter voltage available from such systems is directly related to the generator terminal voltage. Reference: IEEE 421.5-2005, 7.1.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcIEEEST1A {
4    #[serde(flatten)]
5    pub base: super::ExcitationSystemDynamics,
6    /// Exciter output current limit reference (ILR). Typical value = 0.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub ilr: Option<f64>,
9    /// Voltage regulator gain (KA) (> 0). Typical value = 190.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub ka: Option<f64>,
12    /// Rectifier loading factor proportional to commutating reactance (KC) (>= 0). Typical value = 0,08.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub kc: Option<f64>,
15    /// Excitation control system stabilizer gains (KF) (>= 0). Typical value = 0.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub kf: Option<f64>,
18    /// Exciter output current limiter gain (KLR). Typical value = 0.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub klr: Option<f64>,
21    /// Selector of the Power System Stabilizer (PSS) input (PSSin). true = PSS input (Vs) added to error signal false = PSS input (Vs) added to voltage regulator output. Typical value = true.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub pssin: Option<bool>,
24    /// Voltage regulator time constant (TA) (>= 0). Typical value = 0.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub ta: Option<f64>,
27    /// Voltage regulator time constant (TB) (>= 0). Typical value = 10.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub tb: Option<f64>,
30    /// Voltage regulator time constant (TB1) (>= 0). Typical value = 0.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub tb1: Option<f64>,
33    /// Voltage regulator time constant (TC) (>= 0). Typical value = 1.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub tc: Option<f64>,
36    /// Voltage regulator time constant (TC1) (>= 0). Typical value = 0.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub tc1: Option<f64>,
39    /// Excitation control system stabilizer time constant (TF) (>= 0). Typical value = 1.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub tf: Option<f64>,
42    /// Selector of the connection of the UEL input (UELin). Typical value = ignoreUELsignal.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub uelin: Option<super::base::UriRef>,
45    /// Maximum voltage regulator output (VAMAX) (> 0). Typical value = 14,5.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub vamax: Option<f64>,
48    /// Minimum voltage regulator output (VAMIN) (< 0). Typical value = -14,5.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub vamin: Option<f64>,
51    /// Maximum voltage regulator input limit (VIMAX) (> 0). Typical value = 999.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub vimax: Option<f64>,
54    /// Minimum voltage regulator input limit (VIMIN) (< 0). Typical value = -999.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub vimin: Option<f64>,
57    /// Maximum voltage regulator outputs (VRMAX) (> 0). Typical value = 7,8.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub vrmax: Option<f64>,
60    /// Minimum voltage regulator outputs (VRMIN) (< 0). Typical value = -6,7.
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub vrmin: Option<f64>,
63}
64impl crate::base::CimElement for ExcIEEEST1A {
65    fn mrid(&self) -> &str { &self.base.base.base.id }
66    fn type_name(&self) -> &'static str { "ExcIEEEST1A" }
67    fn as_any(&self) -> &dyn std::any::Any { self }
68    fn to_json_value(&self) -> serde_json::Value {
69        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
70    }
71    fn to_block(&self) -> crate::base::RdfBlock {
72        let mut block = self.base.to_block();
73        block.type_name = "ExcIEEEST1A".to_string();
74        if let Some(v) = self.ilr {
75            block.fields.insert("ExcIEEEST1A.ilr".into(), crate::base::FieldValue::Text(v.to_string()));
76        }
77        if let Some(v) = self.ka {
78            block.fields.insert("ExcIEEEST1A.ka".into(), crate::base::FieldValue::Text(v.to_string()));
79        }
80        if let Some(v) = self.kc {
81            block.fields.insert("ExcIEEEST1A.kc".into(), crate::base::FieldValue::Text(v.to_string()));
82        }
83        if let Some(v) = self.kf {
84            block.fields.insert("ExcIEEEST1A.kf".into(), crate::base::FieldValue::Text(v.to_string()));
85        }
86        if let Some(v) = self.klr {
87            block.fields.insert("ExcIEEEST1A.klr".into(), crate::base::FieldValue::Text(v.to_string()));
88        }
89        if let Some(v) = self.pssin {
90            block.fields.insert("ExcIEEEST1A.pssin".into(), crate::base::FieldValue::Text(v.to_string()));
91        }
92        if let Some(v) = self.ta {
93            block.fields.insert("ExcIEEEST1A.ta".into(), crate::base::FieldValue::Text(v.to_string()));
94        }
95        if let Some(v) = self.tb {
96            block.fields.insert("ExcIEEEST1A.tb".into(), crate::base::FieldValue::Text(v.to_string()));
97        }
98        if let Some(v) = self.tb1 {
99            block.fields.insert("ExcIEEEST1A.tb1".into(), crate::base::FieldValue::Text(v.to_string()));
100        }
101        if let Some(v) = self.tc {
102            block.fields.insert("ExcIEEEST1A.tc".into(), crate::base::FieldValue::Text(v.to_string()));
103        }
104        if let Some(v) = self.tc1 {
105            block.fields.insert("ExcIEEEST1A.tc1".into(), crate::base::FieldValue::Text(v.to_string()));
106        }
107        if let Some(v) = self.tf {
108            block.fields.insert("ExcIEEEST1A.tf".into(), crate::base::FieldValue::Text(v.to_string()));
109        }
110        if let Some(ref v) = self.uelin {
111            block.fields.insert("ExcIEEEST1A.uelin".into(), crate::base::FieldValue::Resource(v.uri.clone()));
112        }
113        if let Some(v) = self.vamax {
114            block.fields.insert("ExcIEEEST1A.vamax".into(), crate::base::FieldValue::Text(v.to_string()));
115        }
116        if let Some(v) = self.vamin {
117            block.fields.insert("ExcIEEEST1A.vamin".into(), crate::base::FieldValue::Text(v.to_string()));
118        }
119        if let Some(v) = self.vimax {
120            block.fields.insert("ExcIEEEST1A.vimax".into(), crate::base::FieldValue::Text(v.to_string()));
121        }
122        if let Some(v) = self.vimin {
123            block.fields.insert("ExcIEEEST1A.vimin".into(), crate::base::FieldValue::Text(v.to_string()));
124        }
125        if let Some(v) = self.vrmax {
126            block.fields.insert("ExcIEEEST1A.vrmax".into(), crate::base::FieldValue::Text(v.to_string()));
127        }
128        if let Some(v) = self.vrmin {
129            block.fields.insert("ExcIEEEST1A.vrmin".into(), crate::base::FieldValue::Text(v.to_string()));
130        }
131        block
132    }
133}
134
135impl ExcIEEEST1A {
136    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
137        let mut obj = Self::default();
138        obj.base.base.base.id.clone_from(&b.mrid);
139        for (key, val) in &b.fields {
140            match key.as_str() {
141                "ExcIEEEST1A.ilr" => {
142                    match val {
143                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ilr = Some(v); } }
144                        crate::base::FieldValue::TextList(svs) => {
145                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ilr = Some(v); } }
146                        }
147                        _ => {}
148                    }
149                }
150                "ExcIEEEST1A.ka" => {
151                    match val {
152                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
153                        crate::base::FieldValue::TextList(svs) => {
154                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
155                        }
156                        _ => {}
157                    }
158                }
159                "ExcIEEEST1A.kc" => {
160                    match val {
161                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
162                        crate::base::FieldValue::TextList(svs) => {
163                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
164                        }
165                        _ => {}
166                    }
167                }
168                "ExcIEEEST1A.kf" => {
169                    match val {
170                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kf = Some(v); } }
171                        crate::base::FieldValue::TextList(svs) => {
172                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kf = Some(v); } }
173                        }
174                        _ => {}
175                    }
176                }
177                "ExcIEEEST1A.klr" => {
178                    match val {
179                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.klr = Some(v); } }
180                        crate::base::FieldValue::TextList(svs) => {
181                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.klr = Some(v); } }
182                        }
183                        _ => {}
184                    }
185                }
186                "ExcIEEEST1A.pssin" => {
187                    match val {
188                        crate::base::FieldValue::Text(sv) => { obj.pssin = Some(sv.trim() == "true"); }
189                        crate::base::FieldValue::TextList(svs) => {
190                            if let Some(sv) = svs.last() { obj.pssin = Some(sv.trim() == "true"); }
191                        }
192                        _ => {}
193                    }
194                }
195                "ExcIEEEST1A.ta" => {
196                    match val {
197                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
198                        crate::base::FieldValue::TextList(svs) => {
199                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
200                        }
201                        _ => {}
202                    }
203                }
204                "ExcIEEEST1A.tb" => {
205                    match val {
206                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
207                        crate::base::FieldValue::TextList(svs) => {
208                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
209                        }
210                        _ => {}
211                    }
212                }
213                "ExcIEEEST1A.tb1" => {
214                    match val {
215                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tb1 = Some(v); } }
216                        crate::base::FieldValue::TextList(svs) => {
217                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tb1 = Some(v); } }
218                        }
219                        _ => {}
220                    }
221                }
222                "ExcIEEEST1A.tc" => {
223                    match val {
224                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
225                        crate::base::FieldValue::TextList(svs) => {
226                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
227                        }
228                        _ => {}
229                    }
230                }
231                "ExcIEEEST1A.tc1" => {
232                    match val {
233                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tc1 = Some(v); } }
234                        crate::base::FieldValue::TextList(svs) => {
235                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tc1 = Some(v); } }
236                        }
237                        _ => {}
238                    }
239                }
240                "ExcIEEEST1A.tf" => {
241                    match val {
242                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
243                        crate::base::FieldValue::TextList(svs) => {
244                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
245                        }
246                        _ => {}
247                    }
248                }
249                "ExcIEEEST1A.uelin" => {
250                    if let crate::base::FieldValue::Resource(sv) = val {
251                        obj.uelin = Some(crate::base::UriRef { uri: sv.clone() });
252                    }
253                }
254                "ExcIEEEST1A.vamax" => {
255                    match val {
256                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vamax = Some(v); } }
257                        crate::base::FieldValue::TextList(svs) => {
258                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vamax = Some(v); } }
259                        }
260                        _ => {}
261                    }
262                }
263                "ExcIEEEST1A.vamin" => {
264                    match val {
265                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vamin = Some(v); } }
266                        crate::base::FieldValue::TextList(svs) => {
267                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vamin = Some(v); } }
268                        }
269                        _ => {}
270                    }
271                }
272                "ExcIEEEST1A.vimax" => {
273                    match val {
274                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vimax = Some(v); } }
275                        crate::base::FieldValue::TextList(svs) => {
276                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vimax = Some(v); } }
277                        }
278                        _ => {}
279                    }
280                }
281                "ExcIEEEST1A.vimin" => {
282                    match val {
283                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vimin = Some(v); } }
284                        crate::base::FieldValue::TextList(svs) => {
285                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vimin = Some(v); } }
286                        }
287                        _ => {}
288                    }
289                }
290                "ExcIEEEST1A.vrmax" => {
291                    match val {
292                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
293                        crate::base::FieldValue::TextList(svs) => {
294                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
295                        }
296                        _ => {}
297                    }
298                }
299                "ExcIEEEST1A.vrmin" => {
300                    match val {
301                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
302                        crate::base::FieldValue::TextList(svs) => {
303                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
304                        }
305                        _ => {}
306                    }
307                }
308                "ExcitationSystemDynamics.SynchronousMachineDynamics" => {
309                    if let crate::base::FieldValue::Resource(sv) = val {
310                        obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
311                    }
312                }
313                "DynamicsFunctionBlock.enabled" => {
314                    match val {
315                        crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
316                        crate::base::FieldValue::TextList(svs) => {
317                            if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
318                        }
319                        _ => {}
320                    }
321                }
322                "IdentifiedObject.description" => {
323                    match val {
324                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
325                        crate::base::FieldValue::TextList(svs) => {
326                            if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
327                        }
328                        _ => {}
329                    }
330                }
331                "IdentifiedObject.energyIdentCodeEic" => {
332                    match val {
333                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
334                        crate::base::FieldValue::TextList(svs) => {
335                            if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
336                        }
337                        _ => {}
338                    }
339                }
340                "IdentifiedObject.mRID" => {
341                    match val {
342                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
343                        crate::base::FieldValue::TextList(svs) => {
344                            if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
345                        }
346                        _ => {}
347                    }
348                }
349                "IdentifiedObject.name" => {
350                    match val {
351                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
352                        crate::base::FieldValue::TextList(svs) => {
353                            if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
354                        }
355                        _ => {}
356                    }
357                }
358                "IdentifiedObject.shortName" => {
359                    match val {
360                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
361                        crate::base::FieldValue::TextList(svs) => {
362                            if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
363                        }
364                        _ => {}
365                    }
366                }
367                _ => {}
368            }
369        }
370        obj
371    }
372}