Skip to main content

cimstructs/
ExcAC6A.rs

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