Skip to main content

cimstructs/
ExcAC1A.rs

1/// Modified IEEE AC1A alternator-supplied rectifier excitation system with different rate feedback source.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcAC1A {
4    #[serde(flatten)]
5    pub base: super::ExcitationSystemDynamics,
6    /// Indicates if both HV gate and LV gate are active (HVLVgates). true = gates are used false = gates are not used. Typical value = true.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub hvlvgates: Option<bool>,
9    /// Voltage regulator gain (Ka) (> 0). Typical value = 400.
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,2.
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,38.
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,03.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub kf: Option<f64>,
24    /// Coefficient to allow different usage of the model (Kf1) (>= 0). Typical value = 0.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub kf1: Option<f64>,
27    /// Coefficient to allow different usage of the model (Kf2) (>= 0). Typical value = 1.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub kf2: Option<f64>,
30    /// Coefficient to allow different usage of the model-speed coefficient (Ks) (>= 0). Typical value = 0.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub ks: Option<f64>,
33    /// Exciter saturation function value at the corresponding exciter voltage, Ve1, back of commutating reactance (Se[Ve1]) (>= 0). Typical value = 0,1.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub seve1: Option<f64>,
36    /// Exciter saturation function value at the corresponding exciter voltage, Ve2, back of commutating reactance (Se[Ve2]) (>= 0). Typical value = 0,03.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub seve2: Option<f64>,
39    /// Voltage regulator time constant (Ta) (> 0). Typical value = 0,02.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub ta: Option<f64>,
42    /// Voltage regulator time constant (Tb) (>= 0). Typical value = 0.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub tb: Option<f64>,
45    /// Voltage regulator time constant (Tc) (>= 0). Typical value = 0.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub tc: Option<f64>,
48    /// Exciter time constant, integration rate associated with exciter control (Te) (> 0). Typical value = 0,8.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub te: Option<f64>,
51    /// Excitation control system stabilizer time constant (Tf) (> 0). Typical value = 1.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub tf: Option<f64>,
54    /// Maximum voltage regulator output (Vamax) (> 0). Typical value = 14,5.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub vamax: Option<f64>,
57    /// Minimum voltage regulator output (Vamin) (< 0). Typical value = -14,5.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub vamin: Option<f64>,
60    /// Exciter alternator output voltages back of commutating reactance at which saturation is defined (Ve1) (> 0). Typical value = 4,18.
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub ve1: Option<f64>,
63    /// Exciter alternator output voltages back of commutating reactance at which saturation is defined (Ve2) (> 0). Typical value = 3,14.
64    #[serde(skip_serializing_if = "Option::is_none")]
65    pub ve2: Option<f64>,
66    /// Maximum voltage regulator outputs (Vrmax) (> 0). Typical value = 6,03.
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub vrmax: Option<f64>,
69    /// Minimum voltage regulator outputs (Vrmin) (< 0). Typical value = -5,43.
70    #[serde(skip_serializing_if = "Option::is_none")]
71    pub vrmin: Option<f64>,
72}
73impl crate::base::CimElement for ExcAC1A {
74    fn mrid(&self) -> &str { &self.base.base.base.id }
75    fn type_name(&self) -> &'static str { "ExcAC1A" }
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 = "ExcAC1A".to_string();
83        if let Some(v) = self.hvlvgates {
84            block.fields.insert("ExcAC1A.hvlvgates".into(), crate::base::FieldValue::Text(v.to_string()));
85        }
86        if let Some(v) = self.ka {
87            block.fields.insert("ExcAC1A.ka".into(), crate::base::FieldValue::Text(v.to_string()));
88        }
89        if let Some(v) = self.kc {
90            block.fields.insert("ExcAC1A.kc".into(), crate::base::FieldValue::Text(v.to_string()));
91        }
92        if let Some(v) = self.kd {
93            block.fields.insert("ExcAC1A.kd".into(), crate::base::FieldValue::Text(v.to_string()));
94        }
95        if let Some(v) = self.ke {
96            block.fields.insert("ExcAC1A.ke".into(), crate::base::FieldValue::Text(v.to_string()));
97        }
98        if let Some(v) = self.kf {
99            block.fields.insert("ExcAC1A.kf".into(), crate::base::FieldValue::Text(v.to_string()));
100        }
101        if let Some(v) = self.kf1 {
102            block.fields.insert("ExcAC1A.kf1".into(), crate::base::FieldValue::Text(v.to_string()));
103        }
104        if let Some(v) = self.kf2 {
105            block.fields.insert("ExcAC1A.kf2".into(), crate::base::FieldValue::Text(v.to_string()));
106        }
107        if let Some(v) = self.ks {
108            block.fields.insert("ExcAC1A.ks".into(), crate::base::FieldValue::Text(v.to_string()));
109        }
110        if let Some(v) = self.seve1 {
111            block.fields.insert("ExcAC1A.seve1".into(), crate::base::FieldValue::Text(v.to_string()));
112        }
113        if let Some(v) = self.seve2 {
114            block.fields.insert("ExcAC1A.seve2".into(), crate::base::FieldValue::Text(v.to_string()));
115        }
116        if let Some(v) = self.ta {
117            block.fields.insert("ExcAC1A.ta".into(), crate::base::FieldValue::Text(v.to_string()));
118        }
119        if let Some(v) = self.tb {
120            block.fields.insert("ExcAC1A.tb".into(), crate::base::FieldValue::Text(v.to_string()));
121        }
122        if let Some(v) = self.tc {
123            block.fields.insert("ExcAC1A.tc".into(), crate::base::FieldValue::Text(v.to_string()));
124        }
125        if let Some(v) = self.te {
126            block.fields.insert("ExcAC1A.te".into(), crate::base::FieldValue::Text(v.to_string()));
127        }
128        if let Some(v) = self.tf {
129            block.fields.insert("ExcAC1A.tf".into(), crate::base::FieldValue::Text(v.to_string()));
130        }
131        if let Some(v) = self.vamax {
132            block.fields.insert("ExcAC1A.vamax".into(), crate::base::FieldValue::Text(v.to_string()));
133        }
134        if let Some(v) = self.vamin {
135            block.fields.insert("ExcAC1A.vamin".into(), crate::base::FieldValue::Text(v.to_string()));
136        }
137        if let Some(v) = self.ve1 {
138            block.fields.insert("ExcAC1A.ve1".into(), crate::base::FieldValue::Text(v.to_string()));
139        }
140        if let Some(v) = self.ve2 {
141            block.fields.insert("ExcAC1A.ve2".into(), crate::base::FieldValue::Text(v.to_string()));
142        }
143        if let Some(v) = self.vrmax {
144            block.fields.insert("ExcAC1A.vrmax".into(), crate::base::FieldValue::Text(v.to_string()));
145        }
146        if let Some(v) = self.vrmin {
147            block.fields.insert("ExcAC1A.vrmin".into(), crate::base::FieldValue::Text(v.to_string()));
148        }
149        block
150    }
151}
152
153impl ExcAC1A {
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                "ExcAC1A.hvlvgates" => {
160                    match val {
161                        crate::base::FieldValue::Text(sv) => { obj.hvlvgates = Some(sv.trim() == "true"); }
162                        crate::base::FieldValue::TextList(svs) => {
163                            if let Some(sv) = svs.last() { obj.hvlvgates = Some(sv.trim() == "true"); }
164                        }
165                        _ => {}
166                    }
167                }
168                "ExcAC1A.ka" => {
169                    match val {
170                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
171                        crate::base::FieldValue::TextList(svs) => {
172                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
173                        }
174                        _ => {}
175                    }
176                }
177                "ExcAC1A.kc" => {
178                    match val {
179                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
180                        crate::base::FieldValue::TextList(svs) => {
181                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
182                        }
183                        _ => {}
184                    }
185                }
186                "ExcAC1A.kd" => {
187                    match val {
188                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kd = Some(v); } }
189                        crate::base::FieldValue::TextList(svs) => {
190                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kd = Some(v); } }
191                        }
192                        _ => {}
193                    }
194                }
195                "ExcAC1A.ke" => {
196                    match val {
197                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
198                        crate::base::FieldValue::TextList(svs) => {
199                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
200                        }
201                        _ => {}
202                    }
203                }
204                "ExcAC1A.kf" => {
205                    match val {
206                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kf = Some(v); } }
207                        crate::base::FieldValue::TextList(svs) => {
208                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kf = Some(v); } }
209                        }
210                        _ => {}
211                    }
212                }
213                "ExcAC1A.kf1" => {
214                    match val {
215                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kf1 = Some(v); } }
216                        crate::base::FieldValue::TextList(svs) => {
217                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kf1 = Some(v); } }
218                        }
219                        _ => {}
220                    }
221                }
222                "ExcAC1A.kf2" => {
223                    match val {
224                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kf2 = Some(v); } }
225                        crate::base::FieldValue::TextList(svs) => {
226                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kf2 = Some(v); } }
227                        }
228                        _ => {}
229                    }
230                }
231                "ExcAC1A.ks" => {
232                    match val {
233                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ks = Some(v); } }
234                        crate::base::FieldValue::TextList(svs) => {
235                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ks = Some(v); } }
236                        }
237                        _ => {}
238                    }
239                }
240                "ExcAC1A.seve1" => {
241                    match val {
242                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seve1 = Some(v); } }
243                        crate::base::FieldValue::TextList(svs) => {
244                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seve1 = Some(v); } }
245                        }
246                        _ => {}
247                    }
248                }
249                "ExcAC1A.seve2" => {
250                    match val {
251                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seve2 = Some(v); } }
252                        crate::base::FieldValue::TextList(svs) => {
253                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seve2 = Some(v); } }
254                        }
255                        _ => {}
256                    }
257                }
258                "ExcAC1A.ta" => {
259                    match val {
260                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
261                        crate::base::FieldValue::TextList(svs) => {
262                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
263                        }
264                        _ => {}
265                    }
266                }
267                "ExcAC1A.tb" => {
268                    match val {
269                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
270                        crate::base::FieldValue::TextList(svs) => {
271                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
272                        }
273                        _ => {}
274                    }
275                }
276                "ExcAC1A.tc" => {
277                    match val {
278                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
279                        crate::base::FieldValue::TextList(svs) => {
280                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
281                        }
282                        _ => {}
283                    }
284                }
285                "ExcAC1A.te" => {
286                    match val {
287                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
288                        crate::base::FieldValue::TextList(svs) => {
289                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
290                        }
291                        _ => {}
292                    }
293                }
294                "ExcAC1A.tf" => {
295                    match val {
296                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
297                        crate::base::FieldValue::TextList(svs) => {
298                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
299                        }
300                        _ => {}
301                    }
302                }
303                "ExcAC1A.vamax" => {
304                    match val {
305                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vamax = Some(v); } }
306                        crate::base::FieldValue::TextList(svs) => {
307                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vamax = Some(v); } }
308                        }
309                        _ => {}
310                    }
311                }
312                "ExcAC1A.vamin" => {
313                    match val {
314                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vamin = Some(v); } }
315                        crate::base::FieldValue::TextList(svs) => {
316                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vamin = Some(v); } }
317                        }
318                        _ => {}
319                    }
320                }
321                "ExcAC1A.ve1" => {
322                    match val {
323                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ve1 = Some(v); } }
324                        crate::base::FieldValue::TextList(svs) => {
325                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ve1 = Some(v); } }
326                        }
327                        _ => {}
328                    }
329                }
330                "ExcAC1A.ve2" => {
331                    match val {
332                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ve2 = Some(v); } }
333                        crate::base::FieldValue::TextList(svs) => {
334                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ve2 = Some(v); } }
335                        }
336                        _ => {}
337                    }
338                }
339                "ExcAC1A.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                "ExcAC1A.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}