Skip to main content

cimstructs/
ExcIEEEAC6A.rs

1/// IEEE 421.5-2005 type AC6A model. The model represents field-controlled alternator-rectifier excitation systems with system-supplied electronic voltage regulators. The maximum output of the regulator, VR, is a function of terminal voltage, VT. The field current limiter included in the original model AC6A remains in the 2005 update. Reference: IEEE 421.5-2005, 6.6.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcIEEEAC6A {
4    #[serde(flatten)]
5    pub base: super::ExcitationSystemDynamics,
6    /// Voltage regulator gain (KA) (> 0). Typical value = 536.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub ka: Option<f64>,
9    /// Rectifier loading factor proportional to commutating reactance (KC) (>= 0). Typical value = 0,173.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub kc: Option<f64>,
12    /// Demagnetizing factor, a function of exciter alternator reactances (KD) (>= 0). Typical value = 1,91.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub kd: Option<f64>,
15    /// Exciter constant related to self-excited field (KE). Typical value = 1,6.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub ke: Option<f64>,
18    /// Exciter field current limiter gain (KH) (>= 0). Typical value = 92.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub kh: Option<f64>,
21    /// Exciter saturation function value at the corresponding exciter voltage, VE1, back of commutating reactance (SE[VE1]) (>= 0). Typical value = 0,214.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub seve1: Option<f64>,
24    /// Exciter saturation function value at the corresponding exciter voltage, VE2, back of commutating reactance (SE[VE2]) (>= 0). Typical value = 0,044.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub seve2: Option<f64>,
27    /// Voltage regulator time constant (TA) (>= 0). Typical value = 0,086.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub ta: Option<f64>,
30    /// Voltage regulator time constant (TB) (>= 0). Typical value = 9.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub tb: Option<f64>,
33    /// Voltage regulator time constant (TC) (>= 0). Typical value = 3.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub tc: Option<f64>,
36    /// Exciter time constant, integration rate associated with exciter control (TE) (> 0). Typical value = 1.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub te: Option<f64>,
39    /// Exciter field current limiter time constant (TH) (> 0). Typical value = 0,08.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub th: Option<f64>,
42    /// Exciter field current limiter time constant (TJ) (>= 0). Typical value = 0,02.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub tj: Option<f64>,
45    /// Voltage regulator time constant (TK) (>= 0). Typical value = 0,18.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub tk: Option<f64>,
48    /// Maximum voltage regulator output (VAMAX) (> 0). Typical value = 75.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub vamax: Option<f64>,
51    /// Minimum voltage regulator output (VAMIN) (< 0). Typical value = -75.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub vamin: Option<f64>,
54    /// Exciter alternator output voltages back of commutating reactance at which saturation is defined (VE1) (> 0). Typical value = 7,4.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub ve1: Option<f64>,
57    /// Exciter alternator output voltages back of commutating reactance at which saturation is defined (VE2) (> 0). Typical value = 5,55.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub ve2: Option<f64>,
60    /// Exciter field current limit reference (VFELIM) (> 0). Typical value = 19.
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub vfelim: Option<f64>,
63    /// Maximum field current limiter signal reference (VHMAX) (> 0). Typical value = 75.
64    #[serde(skip_serializing_if = "Option::is_none")]
65    pub vhmax: Option<f64>,
66    /// Maximum voltage regulator output (VRMAX) (> 0). Typical value = 44.
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub vrmax: Option<f64>,
69    /// Minimum voltage regulator output (VRMIN) (< 0). Typical value = -36.
70    #[serde(skip_serializing_if = "Option::is_none")]
71    pub vrmin: Option<f64>,
72}
73impl crate::base::CimElement for ExcIEEEAC6A {
74    fn mrid(&self) -> &str { &self.base.base.base.id }
75    fn type_name(&self) -> &'static str { "ExcIEEEAC6A" }
76    fn as_any(&self) -> &dyn std::any::Any { self }
77    fn to_json_value(&self) -> serde_json::Value {
78        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
79    }
80    fn to_block(&self) -> crate::base::RdfBlock {
81        let mut block = self.base.to_block();
82        block.type_name = "ExcIEEEAC6A".to_string();
83        if let Some(v) = self.ka {
84            block.fields.insert("ExcIEEEAC6A.ka".into(), crate::base::FieldValue::Text(v.to_string()));
85        }
86        if let Some(v) = self.kc {
87            block.fields.insert("ExcIEEEAC6A.kc".into(), crate::base::FieldValue::Text(v.to_string()));
88        }
89        if let Some(v) = self.kd {
90            block.fields.insert("ExcIEEEAC6A.kd".into(), crate::base::FieldValue::Text(v.to_string()));
91        }
92        if let Some(v) = self.ke {
93            block.fields.insert("ExcIEEEAC6A.ke".into(), crate::base::FieldValue::Text(v.to_string()));
94        }
95        if let Some(v) = self.kh {
96            block.fields.insert("ExcIEEEAC6A.kh".into(), crate::base::FieldValue::Text(v.to_string()));
97        }
98        if let Some(v) = self.seve1 {
99            block.fields.insert("ExcIEEEAC6A.seve1".into(), crate::base::FieldValue::Text(v.to_string()));
100        }
101        if let Some(v) = self.seve2 {
102            block.fields.insert("ExcIEEEAC6A.seve2".into(), crate::base::FieldValue::Text(v.to_string()));
103        }
104        if let Some(v) = self.ta {
105            block.fields.insert("ExcIEEEAC6A.ta".into(), crate::base::FieldValue::Text(v.to_string()));
106        }
107        if let Some(v) = self.tb {
108            block.fields.insert("ExcIEEEAC6A.tb".into(), crate::base::FieldValue::Text(v.to_string()));
109        }
110        if let Some(v) = self.tc {
111            block.fields.insert("ExcIEEEAC6A.tc".into(), crate::base::FieldValue::Text(v.to_string()));
112        }
113        if let Some(v) = self.te {
114            block.fields.insert("ExcIEEEAC6A.te".into(), crate::base::FieldValue::Text(v.to_string()));
115        }
116        if let Some(v) = self.th {
117            block.fields.insert("ExcIEEEAC6A.th".into(), crate::base::FieldValue::Text(v.to_string()));
118        }
119        if let Some(v) = self.tj {
120            block.fields.insert("ExcIEEEAC6A.tj".into(), crate::base::FieldValue::Text(v.to_string()));
121        }
122        if let Some(v) = self.tk {
123            block.fields.insert("ExcIEEEAC6A.tk".into(), crate::base::FieldValue::Text(v.to_string()));
124        }
125        if let Some(v) = self.vamax {
126            block.fields.insert("ExcIEEEAC6A.vamax".into(), crate::base::FieldValue::Text(v.to_string()));
127        }
128        if let Some(v) = self.vamin {
129            block.fields.insert("ExcIEEEAC6A.vamin".into(), crate::base::FieldValue::Text(v.to_string()));
130        }
131        if let Some(v) = self.ve1 {
132            block.fields.insert("ExcIEEEAC6A.ve1".into(), crate::base::FieldValue::Text(v.to_string()));
133        }
134        if let Some(v) = self.ve2 {
135            block.fields.insert("ExcIEEEAC6A.ve2".into(), crate::base::FieldValue::Text(v.to_string()));
136        }
137        if let Some(v) = self.vfelim {
138            block.fields.insert("ExcIEEEAC6A.vfelim".into(), crate::base::FieldValue::Text(v.to_string()));
139        }
140        if let Some(v) = self.vhmax {
141            block.fields.insert("ExcIEEEAC6A.vhmax".into(), crate::base::FieldValue::Text(v.to_string()));
142        }
143        if let Some(v) = self.vrmax {
144            block.fields.insert("ExcIEEEAC6A.vrmax".into(), crate::base::FieldValue::Text(v.to_string()));
145        }
146        if let Some(v) = self.vrmin {
147            block.fields.insert("ExcIEEEAC6A.vrmin".into(), crate::base::FieldValue::Text(v.to_string()));
148        }
149        block
150    }
151}
152
153impl ExcIEEEAC6A {
154    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
155        let mut obj = Self::default();
156        obj.base.base.base.id.clone_from(&b.mrid);
157        for (key, val) in &b.fields {
158            match key.as_str() {
159                "ExcIEEEAC6A.ka" => {
160                    match val {
161                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
162                        crate::base::FieldValue::TextList(svs) => {
163                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
164                        }
165                        _ => {}
166                    }
167                }
168                "ExcIEEEAC6A.kc" => {
169                    match val {
170                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
171                        crate::base::FieldValue::TextList(svs) => {
172                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
173                        }
174                        _ => {}
175                    }
176                }
177                "ExcIEEEAC6A.kd" => {
178                    match val {
179                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kd = Some(v); } }
180                        crate::base::FieldValue::TextList(svs) => {
181                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kd = Some(v); } }
182                        }
183                        _ => {}
184                    }
185                }
186                "ExcIEEEAC6A.ke" => {
187                    match val {
188                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
189                        crate::base::FieldValue::TextList(svs) => {
190                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
191                        }
192                        _ => {}
193                    }
194                }
195                "ExcIEEEAC6A.kh" => {
196                    match val {
197                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kh = Some(v); } }
198                        crate::base::FieldValue::TextList(svs) => {
199                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kh = Some(v); } }
200                        }
201                        _ => {}
202                    }
203                }
204                "ExcIEEEAC6A.seve1" => {
205                    match val {
206                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seve1 = Some(v); } }
207                        crate::base::FieldValue::TextList(svs) => {
208                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seve1 = Some(v); } }
209                        }
210                        _ => {}
211                    }
212                }
213                "ExcIEEEAC6A.seve2" => {
214                    match val {
215                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seve2 = Some(v); } }
216                        crate::base::FieldValue::TextList(svs) => {
217                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seve2 = Some(v); } }
218                        }
219                        _ => {}
220                    }
221                }
222                "ExcIEEEAC6A.ta" => {
223                    match val {
224                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
225                        crate::base::FieldValue::TextList(svs) => {
226                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
227                        }
228                        _ => {}
229                    }
230                }
231                "ExcIEEEAC6A.tb" => {
232                    match val {
233                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
234                        crate::base::FieldValue::TextList(svs) => {
235                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
236                        }
237                        _ => {}
238                    }
239                }
240                "ExcIEEEAC6A.tc" => {
241                    match val {
242                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
243                        crate::base::FieldValue::TextList(svs) => {
244                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
245                        }
246                        _ => {}
247                    }
248                }
249                "ExcIEEEAC6A.te" => {
250                    match val {
251                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
252                        crate::base::FieldValue::TextList(svs) => {
253                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
254                        }
255                        _ => {}
256                    }
257                }
258                "ExcIEEEAC6A.th" => {
259                    match val {
260                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.th = Some(v); } }
261                        crate::base::FieldValue::TextList(svs) => {
262                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.th = Some(v); } }
263                        }
264                        _ => {}
265                    }
266                }
267                "ExcIEEEAC6A.tj" => {
268                    match val {
269                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tj = Some(v); } }
270                        crate::base::FieldValue::TextList(svs) => {
271                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tj = Some(v); } }
272                        }
273                        _ => {}
274                    }
275                }
276                "ExcIEEEAC6A.tk" => {
277                    match val {
278                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tk = Some(v); } }
279                        crate::base::FieldValue::TextList(svs) => {
280                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tk = Some(v); } }
281                        }
282                        _ => {}
283                    }
284                }
285                "ExcIEEEAC6A.vamax" => {
286                    match val {
287                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vamax = Some(v); } }
288                        crate::base::FieldValue::TextList(svs) => {
289                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vamax = Some(v); } }
290                        }
291                        _ => {}
292                    }
293                }
294                "ExcIEEEAC6A.vamin" => {
295                    match val {
296                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vamin = Some(v); } }
297                        crate::base::FieldValue::TextList(svs) => {
298                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vamin = Some(v); } }
299                        }
300                        _ => {}
301                    }
302                }
303                "ExcIEEEAC6A.ve1" => {
304                    match val {
305                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ve1 = Some(v); } }
306                        crate::base::FieldValue::TextList(svs) => {
307                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ve1 = Some(v); } }
308                        }
309                        _ => {}
310                    }
311                }
312                "ExcIEEEAC6A.ve2" => {
313                    match val {
314                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ve2 = Some(v); } }
315                        crate::base::FieldValue::TextList(svs) => {
316                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ve2 = Some(v); } }
317                        }
318                        _ => {}
319                    }
320                }
321                "ExcIEEEAC6A.vfelim" => {
322                    match val {
323                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vfelim = Some(v); } }
324                        crate::base::FieldValue::TextList(svs) => {
325                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vfelim = Some(v); } }
326                        }
327                        _ => {}
328                    }
329                }
330                "ExcIEEEAC6A.vhmax" => {
331                    match val {
332                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vhmax = Some(v); } }
333                        crate::base::FieldValue::TextList(svs) => {
334                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vhmax = Some(v); } }
335                        }
336                        _ => {}
337                    }
338                }
339                "ExcIEEEAC6A.vrmax" => {
340                    match val {
341                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
342                        crate::base::FieldValue::TextList(svs) => {
343                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
344                        }
345                        _ => {}
346                    }
347                }
348                "ExcIEEEAC6A.vrmin" => {
349                    match val {
350                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
351                        crate::base::FieldValue::TextList(svs) => {
352                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
353                        }
354                        _ => {}
355                    }
356                }
357                "ExcitationSystemDynamics.SynchronousMachineDynamics" => {
358                    if let crate::base::FieldValue::Resource(sv) = val {
359                        obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
360                    }
361                }
362                "DynamicsFunctionBlock.enabled" => {
363                    match val {
364                        crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
365                        crate::base::FieldValue::TextList(svs) => {
366                            if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
367                        }
368                        _ => {}
369                    }
370                }
371                "IdentifiedObject.description" => {
372                    match val {
373                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
374                        crate::base::FieldValue::TextList(svs) => {
375                            if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
376                        }
377                        _ => {}
378                    }
379                }
380                "IdentifiedObject.energyIdentCodeEic" => {
381                    match val {
382                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
383                        crate::base::FieldValue::TextList(svs) => {
384                            if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
385                        }
386                        _ => {}
387                    }
388                }
389                "IdentifiedObject.mRID" => {
390                    match val {
391                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
392                        crate::base::FieldValue::TextList(svs) => {
393                            if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
394                        }
395                        _ => {}
396                    }
397                }
398                "IdentifiedObject.name" => {
399                    match val {
400                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
401                        crate::base::FieldValue::TextList(svs) => {
402                            if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
403                        }
404                        _ => {}
405                    }
406                }
407                "IdentifiedObject.shortName" => {
408                    match val {
409                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
410                        crate::base::FieldValue::TextList(svs) => {
411                            if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
412                        }
413                        _ => {}
414                    }
415                }
416                _ => {}
417            }
418        }
419        obj
420    }
421}