Skip to main content

cimstructs/
ExcAC3A.rs

1/// Modified IEEE AC3A alternator-supplied rectifier excitation system with different field current limit.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcAC3A {
4    #[serde(flatten)]
5    pub base: super::ExcitationSystemDynamics,
6    /// Value of Efd at which feedback gain changes (Efdn) (> 0). Typical value = 2,36.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub efdn: Option<f64>,
9    /// Voltage regulator gain (Ka) (> 0). Typical value = 45,62.
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,104.
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,499.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub kd: Option<f64>,
18    /// Exciter constant related to self-excited field (Ke). 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,143.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub kf: Option<f64>,
24    /// Coefficient to allow different usage of the model (Kf1). Typical value = 1.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub kf1: Option<f64>,
27    /// Coefficient to allow different usage of the model (Kf2). Typical value = 0.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub kf2: Option<f64>,
30    /// Gain used in the minimum field voltage limiter loop (Klv). Typical value = 0,194.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub klv: Option<f64>,
33    /// Excitation control system stabilizer gain (Kn) (>= 0). Typical value =0,05.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub kn: Option<f64>,
36    /// Constant associated with regulator and alternator field power supply (Kr) (> 0). Typical value =3,77.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub kr: Option<f64>,
39    /// Coefficient to allow different usage of the model-speed coefficient (Ks). Typical value = 0.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub ks: Option<f64>,
42    /// Exciter saturation function value at the corresponding exciter voltage, Ve1, back of commutating reactance (Se[Ve1]) (>= 0). Typical value = 1,143.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub seve1: Option<f64>,
45    /// Exciter saturation function value at the corresponding exciter voltage, Ve2, back of commutating reactance (Se[Ve2]) (>= 0). Typical value = 0,1.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub seve2: Option<f64>,
48    /// Voltage regulator time constant (Ta) (> 0). Typical value = 0,013.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub ta: Option<f64>,
51    /// Voltage regulator time constant (Tb) (>= 0). Typical value = 0.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub tb: Option<f64>,
54    /// Voltage regulator time constant (Tc) (>= 0). Typical value = 0.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub tc: Option<f64>,
57    /// Exciter time constant, integration rate associated with exciter control (Te) (> 0). Typical value = 1,17.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub te: Option<f64>,
60    /// Excitation control system stabilizer time constant (Tf) (> 0). Typical value = 1.
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub tf: Option<f64>,
63    /// Maximum voltage regulator output (Vamax) (> 0). Typical value = 1.
64    #[serde(skip_serializing_if = "Option::is_none")]
65    pub vamax: Option<f64>,
66    /// Minimum voltage regulator output (Vamin) (< 0). Typical value = -0,95.
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub vamin: Option<f64>,
69    /// Exciter alternator output voltages back of commutating reactance at which saturation is defined (Ve1) (> 0). Typical value = 6.24.
70    #[serde(skip_serializing_if = "Option::is_none")]
71    pub ve1: Option<f64>,
72    /// Exciter alternator output voltages back of commutating reactance at which saturation is defined (Ve2) (> 0). Typical value = 4,68.
73    #[serde(skip_serializing_if = "Option::is_none")]
74    pub ve2: Option<f64>,
75    /// Minimum exciter voltage output (Vemin) (<= 0). Typical value = 0.
76    #[serde(skip_serializing_if = "Option::is_none")]
77    pub vemin: Option<f64>,
78    /// Exciter field current limit reference (Vfemax) (>= 0). Typical value = 16.
79    #[serde(skip_serializing_if = "Option::is_none")]
80    pub vfemax: Option<f64>,
81    /// Field voltage used in the minimum field voltage limiter loop (Vlv). Typical value = 0,79.
82    #[serde(skip_serializing_if = "Option::is_none")]
83    pub vlv: Option<f64>,
84}
85impl crate::base::CimElement for ExcAC3A {
86    fn mrid(&self) -> &str { &self.base.base.base.id }
87    fn type_name(&self) -> &'static str { "ExcAC3A" }
88    fn as_any(&self) -> &dyn std::any::Any { self }
89    fn to_json_value(&self) -> serde_json::Value {
90        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
91    }
92    fn to_block(&self) -> crate::base::RdfBlock {
93        let mut block = self.base.to_block();
94        block.type_name = "ExcAC3A".to_string();
95        if let Some(v) = self.efdn {
96            block.fields.insert("ExcAC3A.efdn".into(), crate::base::FieldValue::Text(v.to_string()));
97        }
98        if let Some(v) = self.ka {
99            block.fields.insert("ExcAC3A.ka".into(), crate::base::FieldValue::Text(v.to_string()));
100        }
101        if let Some(v) = self.kc {
102            block.fields.insert("ExcAC3A.kc".into(), crate::base::FieldValue::Text(v.to_string()));
103        }
104        if let Some(v) = self.kd {
105            block.fields.insert("ExcAC3A.kd".into(), crate::base::FieldValue::Text(v.to_string()));
106        }
107        if let Some(v) = self.ke {
108            block.fields.insert("ExcAC3A.ke".into(), crate::base::FieldValue::Text(v.to_string()));
109        }
110        if let Some(v) = self.kf {
111            block.fields.insert("ExcAC3A.kf".into(), crate::base::FieldValue::Text(v.to_string()));
112        }
113        if let Some(v) = self.kf1 {
114            block.fields.insert("ExcAC3A.kf1".into(), crate::base::FieldValue::Text(v.to_string()));
115        }
116        if let Some(v) = self.kf2 {
117            block.fields.insert("ExcAC3A.kf2".into(), crate::base::FieldValue::Text(v.to_string()));
118        }
119        if let Some(v) = self.klv {
120            block.fields.insert("ExcAC3A.klv".into(), crate::base::FieldValue::Text(v.to_string()));
121        }
122        if let Some(v) = self.kn {
123            block.fields.insert("ExcAC3A.kn".into(), crate::base::FieldValue::Text(v.to_string()));
124        }
125        if let Some(v) = self.kr {
126            block.fields.insert("ExcAC3A.kr".into(), crate::base::FieldValue::Text(v.to_string()));
127        }
128        if let Some(v) = self.ks {
129            block.fields.insert("ExcAC3A.ks".into(), crate::base::FieldValue::Text(v.to_string()));
130        }
131        if let Some(v) = self.seve1 {
132            block.fields.insert("ExcAC3A.seve1".into(), crate::base::FieldValue::Text(v.to_string()));
133        }
134        if let Some(v) = self.seve2 {
135            block.fields.insert("ExcAC3A.seve2".into(), crate::base::FieldValue::Text(v.to_string()));
136        }
137        if let Some(v) = self.ta {
138            block.fields.insert("ExcAC3A.ta".into(), crate::base::FieldValue::Text(v.to_string()));
139        }
140        if let Some(v) = self.tb {
141            block.fields.insert("ExcAC3A.tb".into(), crate::base::FieldValue::Text(v.to_string()));
142        }
143        if let Some(v) = self.tc {
144            block.fields.insert("ExcAC3A.tc".into(), crate::base::FieldValue::Text(v.to_string()));
145        }
146        if let Some(v) = self.te {
147            block.fields.insert("ExcAC3A.te".into(), crate::base::FieldValue::Text(v.to_string()));
148        }
149        if let Some(v) = self.tf {
150            block.fields.insert("ExcAC3A.tf".into(), crate::base::FieldValue::Text(v.to_string()));
151        }
152        if let Some(v) = self.vamax {
153            block.fields.insert("ExcAC3A.vamax".into(), crate::base::FieldValue::Text(v.to_string()));
154        }
155        if let Some(v) = self.vamin {
156            block.fields.insert("ExcAC3A.vamin".into(), crate::base::FieldValue::Text(v.to_string()));
157        }
158        if let Some(v) = self.ve1 {
159            block.fields.insert("ExcAC3A.ve1".into(), crate::base::FieldValue::Text(v.to_string()));
160        }
161        if let Some(v) = self.ve2 {
162            block.fields.insert("ExcAC3A.ve2".into(), crate::base::FieldValue::Text(v.to_string()));
163        }
164        if let Some(v) = self.vemin {
165            block.fields.insert("ExcAC3A.vemin".into(), crate::base::FieldValue::Text(v.to_string()));
166        }
167        if let Some(v) = self.vfemax {
168            block.fields.insert("ExcAC3A.vfemax".into(), crate::base::FieldValue::Text(v.to_string()));
169        }
170        if let Some(v) = self.vlv {
171            block.fields.insert("ExcAC3A.vlv".into(), crate::base::FieldValue::Text(v.to_string()));
172        }
173        block
174    }
175}
176
177impl ExcAC3A {
178    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
179        let mut obj = Self::default();
180        obj.base.base.base.id.clone_from(&b.mrid);
181        for (key, val) in &b.fields {
182            match key.as_str() {
183                "ExcAC3A.efdn" => {
184                    match val {
185                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.efdn = Some(v); } }
186                        crate::base::FieldValue::TextList(svs) => {
187                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.efdn = Some(v); } }
188                        }
189                        _ => {}
190                    }
191                }
192                "ExcAC3A.ka" => {
193                    match val {
194                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
195                        crate::base::FieldValue::TextList(svs) => {
196                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
197                        }
198                        _ => {}
199                    }
200                }
201                "ExcAC3A.kc" => {
202                    match val {
203                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
204                        crate::base::FieldValue::TextList(svs) => {
205                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
206                        }
207                        _ => {}
208                    }
209                }
210                "ExcAC3A.kd" => {
211                    match val {
212                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kd = Some(v); } }
213                        crate::base::FieldValue::TextList(svs) => {
214                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kd = Some(v); } }
215                        }
216                        _ => {}
217                    }
218                }
219                "ExcAC3A.ke" => {
220                    match val {
221                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
222                        crate::base::FieldValue::TextList(svs) => {
223                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
224                        }
225                        _ => {}
226                    }
227                }
228                "ExcAC3A.kf" => {
229                    match val {
230                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kf = Some(v); } }
231                        crate::base::FieldValue::TextList(svs) => {
232                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kf = Some(v); } }
233                        }
234                        _ => {}
235                    }
236                }
237                "ExcAC3A.kf1" => {
238                    match val {
239                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kf1 = Some(v); } }
240                        crate::base::FieldValue::TextList(svs) => {
241                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kf1 = Some(v); } }
242                        }
243                        _ => {}
244                    }
245                }
246                "ExcAC3A.kf2" => {
247                    match val {
248                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kf2 = Some(v); } }
249                        crate::base::FieldValue::TextList(svs) => {
250                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kf2 = Some(v); } }
251                        }
252                        _ => {}
253                    }
254                }
255                "ExcAC3A.klv" => {
256                    match val {
257                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.klv = Some(v); } }
258                        crate::base::FieldValue::TextList(svs) => {
259                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.klv = Some(v); } }
260                        }
261                        _ => {}
262                    }
263                }
264                "ExcAC3A.kn" => {
265                    match val {
266                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kn = Some(v); } }
267                        crate::base::FieldValue::TextList(svs) => {
268                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kn = Some(v); } }
269                        }
270                        _ => {}
271                    }
272                }
273                "ExcAC3A.kr" => {
274                    match val {
275                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kr = Some(v); } }
276                        crate::base::FieldValue::TextList(svs) => {
277                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kr = Some(v); } }
278                        }
279                        _ => {}
280                    }
281                }
282                "ExcAC3A.ks" => {
283                    match val {
284                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ks = Some(v); } }
285                        crate::base::FieldValue::TextList(svs) => {
286                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ks = Some(v); } }
287                        }
288                        _ => {}
289                    }
290                }
291                "ExcAC3A.seve1" => {
292                    match val {
293                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seve1 = Some(v); } }
294                        crate::base::FieldValue::TextList(svs) => {
295                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seve1 = Some(v); } }
296                        }
297                        _ => {}
298                    }
299                }
300                "ExcAC3A.seve2" => {
301                    match val {
302                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seve2 = Some(v); } }
303                        crate::base::FieldValue::TextList(svs) => {
304                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seve2 = Some(v); } }
305                        }
306                        _ => {}
307                    }
308                }
309                "ExcAC3A.ta" => {
310                    match val {
311                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
312                        crate::base::FieldValue::TextList(svs) => {
313                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
314                        }
315                        _ => {}
316                    }
317                }
318                "ExcAC3A.tb" => {
319                    match val {
320                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
321                        crate::base::FieldValue::TextList(svs) => {
322                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
323                        }
324                        _ => {}
325                    }
326                }
327                "ExcAC3A.tc" => {
328                    match val {
329                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
330                        crate::base::FieldValue::TextList(svs) => {
331                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
332                        }
333                        _ => {}
334                    }
335                }
336                "ExcAC3A.te" => {
337                    match val {
338                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
339                        crate::base::FieldValue::TextList(svs) => {
340                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
341                        }
342                        _ => {}
343                    }
344                }
345                "ExcAC3A.tf" => {
346                    match val {
347                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
348                        crate::base::FieldValue::TextList(svs) => {
349                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
350                        }
351                        _ => {}
352                    }
353                }
354                "ExcAC3A.vamax" => {
355                    match val {
356                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vamax = Some(v); } }
357                        crate::base::FieldValue::TextList(svs) => {
358                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vamax = Some(v); } }
359                        }
360                        _ => {}
361                    }
362                }
363                "ExcAC3A.vamin" => {
364                    match val {
365                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vamin = Some(v); } }
366                        crate::base::FieldValue::TextList(svs) => {
367                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vamin = Some(v); } }
368                        }
369                        _ => {}
370                    }
371                }
372                "ExcAC3A.ve1" => {
373                    match val {
374                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ve1 = Some(v); } }
375                        crate::base::FieldValue::TextList(svs) => {
376                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ve1 = Some(v); } }
377                        }
378                        _ => {}
379                    }
380                }
381                "ExcAC3A.ve2" => {
382                    match val {
383                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ve2 = Some(v); } }
384                        crate::base::FieldValue::TextList(svs) => {
385                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ve2 = Some(v); } }
386                        }
387                        _ => {}
388                    }
389                }
390                "ExcAC3A.vemin" => {
391                    match val {
392                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vemin = Some(v); } }
393                        crate::base::FieldValue::TextList(svs) => {
394                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vemin = Some(v); } }
395                        }
396                        _ => {}
397                    }
398                }
399                "ExcAC3A.vfemax" => {
400                    match val {
401                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vfemax = Some(v); } }
402                        crate::base::FieldValue::TextList(svs) => {
403                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vfemax = Some(v); } }
404                        }
405                        _ => {}
406                    }
407                }
408                "ExcAC3A.vlv" => {
409                    match val {
410                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vlv = Some(v); } }
411                        crate::base::FieldValue::TextList(svs) => {
412                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vlv = Some(v); } }
413                        }
414                        _ => {}
415                    }
416                }
417                "ExcitationSystemDynamics.SynchronousMachineDynamics" => {
418                    if let crate::base::FieldValue::Resource(sv) = val {
419                        obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
420                    }
421                }
422                "DynamicsFunctionBlock.enabled" => {
423                    match val {
424                        crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
425                        crate::base::FieldValue::TextList(svs) => {
426                            if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
427                        }
428                        _ => {}
429                    }
430                }
431                "IdentifiedObject.description" => {
432                    match val {
433                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
434                        crate::base::FieldValue::TextList(svs) => {
435                            if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
436                        }
437                        _ => {}
438                    }
439                }
440                "IdentifiedObject.energyIdentCodeEic" => {
441                    match val {
442                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
443                        crate::base::FieldValue::TextList(svs) => {
444                            if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
445                        }
446                        _ => {}
447                    }
448                }
449                "IdentifiedObject.mRID" => {
450                    match val {
451                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
452                        crate::base::FieldValue::TextList(svs) => {
453                            if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
454                        }
455                        _ => {}
456                    }
457                }
458                "IdentifiedObject.name" => {
459                    match val {
460                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
461                        crate::base::FieldValue::TextList(svs) => {
462                            if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
463                        }
464                        _ => {}
465                    }
466                }
467                "IdentifiedObject.shortName" => {
468                    match val {
469                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
470                        crate::base::FieldValue::TextList(svs) => {
471                            if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
472                        }
473                        _ => {}
474                    }
475                }
476                _ => {}
477            }
478        }
479        obj
480    }
481}