Skip to main content

cimstructs/
ExcIEEEAC2A.rs

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