Skip to main content

cimstructs/
ExcIEEEST3A.rs

1/// IEEE 421.5-2005 type ST3A model. Some static systems utilize a field voltage control loop to linearize the exciter control characteristic. This also makes the output independent of supply source variations until supply limitations are reached. These systems utilize a variety of controlled-rectifier designs: full thyristor complements or hybrid bridges in either series or shunt configurations. The power source can consist of only a potential source, either fed from the machine terminals or from internal windings. Some designs can have compound power sources utilizing both machine potential and current. These power sources are represented as phasor combinations of machine terminal current and voltage and are accommodated by suitable parameters in model type ST3A which is represented by ExcIEEEST3A. Reference: IEEE 421.5-2005, 7.3.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcIEEEST3A {
4    #[serde(flatten)]
5    pub base: super::ExcitationSystemDynamics,
6    /// Voltage regulator gain (KA) (> 0). This is parameter K in the IEEE standard. Typical value = 200.
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,2.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub kc: Option<f64>,
12    /// Feedback gain constant of the inner loop field regulator (KG) (>= 0). Typical value = 1.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub kg: Option<f64>,
15    /// Potential circuit gain coefficient (KI) (>= 0). Typical value = 0.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub ki: Option<f64>,
18    /// Forward gain constant of the inner loop field regulator (KM) (> 0). Typical value = 7,93.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub km: Option<f64>,
21    /// Potential circuit gain coefficient (KP) (> 0). Typical value = 6,15.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub kp: Option<f64>,
24    /// Voltage regulator time constant (TA) (>= 0). Typical value = 0.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub ta: Option<f64>,
27    /// Voltage regulator time constant (TB) (>= 0). Typical value = 10.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub tb: Option<f64>,
30    /// Voltage regulator time constant (TC) (>= 0). Typical value = 1.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub tc: Option<f64>,
33    /// Potential circuit phase angle (thetap). Typical value = 0.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub thetap: Option<f64>,
36    /// Forward time constant of inner loop field regulator (TM) (> 0). Typical value = 0,4.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub tm: Option<f64>,
39    /// Maximum excitation voltage (VBMax) (> 0). Typical value = 6,9.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub vbmax: Option<f64>,
42    /// Maximum inner loop feedback voltage (VGMax) (>= 0). Typical value = 5,8.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub vgmax: Option<f64>,
45    /// Maximum voltage regulator input limit (VIMAX) (> 0). Typical value = 0,2.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub vimax: Option<f64>,
48    /// Minimum voltage regulator input limit (VIMIN) (< 0). Typical value = -0,2.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub vimin: Option<f64>,
51    /// Maximum inner loop output (VMMax) (> 0). Typical value = 1.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub vmmax: Option<f64>,
54    /// Minimum inner loop output (VMMin) (<= 0). Typical value = 0.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub vmmin: Option<f64>,
57    /// Maximum voltage regulator output (VRMAX) (> 0). Typical value = 10.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub vrmax: Option<f64>,
60    /// Minimum voltage regulator output (VRMIN) (< 0). Typical value = -10.
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub vrmin: Option<f64>,
63    /// Reactance associated with potential source (XL) (>= 0). Typical value = 0,081.
64    #[serde(skip_serializing_if = "Option::is_none")]
65    pub xl: Option<f64>,
66}
67impl crate::base::CimElement for ExcIEEEST3A {
68    fn mrid(&self) -> &str { &self.base.base.base.id }
69    fn type_name(&self) -> &'static str { "ExcIEEEST3A" }
70    fn as_any(&self) -> &dyn std::any::Any { self }
71    fn to_json_value(&self) -> serde_json::Value {
72        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
73    }
74    fn to_block(&self) -> crate::base::RdfBlock {
75        let mut block = self.base.to_block();
76        block.type_name = "ExcIEEEST3A".to_string();
77        if let Some(v) = self.ka {
78            block.fields.insert("ExcIEEEST3A.ka".into(), crate::base::FieldValue::Text(v.to_string()));
79        }
80        if let Some(v) = self.kc {
81            block.fields.insert("ExcIEEEST3A.kc".into(), crate::base::FieldValue::Text(v.to_string()));
82        }
83        if let Some(v) = self.kg {
84            block.fields.insert("ExcIEEEST3A.kg".into(), crate::base::FieldValue::Text(v.to_string()));
85        }
86        if let Some(v) = self.ki {
87            block.fields.insert("ExcIEEEST3A.ki".into(), crate::base::FieldValue::Text(v.to_string()));
88        }
89        if let Some(v) = self.km {
90            block.fields.insert("ExcIEEEST3A.km".into(), crate::base::FieldValue::Text(v.to_string()));
91        }
92        if let Some(v) = self.kp {
93            block.fields.insert("ExcIEEEST3A.kp".into(), crate::base::FieldValue::Text(v.to_string()));
94        }
95        if let Some(v) = self.ta {
96            block.fields.insert("ExcIEEEST3A.ta".into(), crate::base::FieldValue::Text(v.to_string()));
97        }
98        if let Some(v) = self.tb {
99            block.fields.insert("ExcIEEEST3A.tb".into(), crate::base::FieldValue::Text(v.to_string()));
100        }
101        if let Some(v) = self.tc {
102            block.fields.insert("ExcIEEEST3A.tc".into(), crate::base::FieldValue::Text(v.to_string()));
103        }
104        if let Some(v) = self.thetap {
105            block.fields.insert("ExcIEEEST3A.thetap".into(), crate::base::FieldValue::Text(v.to_string()));
106        }
107        if let Some(v) = self.tm {
108            block.fields.insert("ExcIEEEST3A.tm".into(), crate::base::FieldValue::Text(v.to_string()));
109        }
110        if let Some(v) = self.vbmax {
111            block.fields.insert("ExcIEEEST3A.vbmax".into(), crate::base::FieldValue::Text(v.to_string()));
112        }
113        if let Some(v) = self.vgmax {
114            block.fields.insert("ExcIEEEST3A.vgmax".into(), crate::base::FieldValue::Text(v.to_string()));
115        }
116        if let Some(v) = self.vimax {
117            block.fields.insert("ExcIEEEST3A.vimax".into(), crate::base::FieldValue::Text(v.to_string()));
118        }
119        if let Some(v) = self.vimin {
120            block.fields.insert("ExcIEEEST3A.vimin".into(), crate::base::FieldValue::Text(v.to_string()));
121        }
122        if let Some(v) = self.vmmax {
123            block.fields.insert("ExcIEEEST3A.vmmax".into(), crate::base::FieldValue::Text(v.to_string()));
124        }
125        if let Some(v) = self.vmmin {
126            block.fields.insert("ExcIEEEST3A.vmmin".into(), crate::base::FieldValue::Text(v.to_string()));
127        }
128        if let Some(v) = self.vrmax {
129            block.fields.insert("ExcIEEEST3A.vrmax".into(), crate::base::FieldValue::Text(v.to_string()));
130        }
131        if let Some(v) = self.vrmin {
132            block.fields.insert("ExcIEEEST3A.vrmin".into(), crate::base::FieldValue::Text(v.to_string()));
133        }
134        if let Some(v) = self.xl {
135            block.fields.insert("ExcIEEEST3A.xl".into(), crate::base::FieldValue::Text(v.to_string()));
136        }
137        block
138    }
139}
140
141impl ExcIEEEST3A {
142    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
143        let mut obj = Self::default();
144        obj.base.base.base.id.clone_from(&b.mrid);
145        for (key, val) in &b.fields {
146            match key.as_str() {
147                "ExcIEEEST3A.ka" => {
148                    match val {
149                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
150                        crate::base::FieldValue::TextList(svs) => {
151                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
152                        }
153                        _ => {}
154                    }
155                }
156                "ExcIEEEST3A.kc" => {
157                    match val {
158                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
159                        crate::base::FieldValue::TextList(svs) => {
160                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
161                        }
162                        _ => {}
163                    }
164                }
165                "ExcIEEEST3A.kg" => {
166                    match val {
167                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kg = Some(v); } }
168                        crate::base::FieldValue::TextList(svs) => {
169                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kg = Some(v); } }
170                        }
171                        _ => {}
172                    }
173                }
174                "ExcIEEEST3A.ki" => {
175                    match val {
176                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ki = Some(v); } }
177                        crate::base::FieldValue::TextList(svs) => {
178                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ki = Some(v); } }
179                        }
180                        _ => {}
181                    }
182                }
183                "ExcIEEEST3A.km" => {
184                    match val {
185                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.km = Some(v); } }
186                        crate::base::FieldValue::TextList(svs) => {
187                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.km = Some(v); } }
188                        }
189                        _ => {}
190                    }
191                }
192                "ExcIEEEST3A.kp" => {
193                    match val {
194                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kp = Some(v); } }
195                        crate::base::FieldValue::TextList(svs) => {
196                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kp = Some(v); } }
197                        }
198                        _ => {}
199                    }
200                }
201                "ExcIEEEST3A.ta" => {
202                    match val {
203                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
204                        crate::base::FieldValue::TextList(svs) => {
205                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
206                        }
207                        _ => {}
208                    }
209                }
210                "ExcIEEEST3A.tb" => {
211                    match val {
212                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
213                        crate::base::FieldValue::TextList(svs) => {
214                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
215                        }
216                        _ => {}
217                    }
218                }
219                "ExcIEEEST3A.tc" => {
220                    match val {
221                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
222                        crate::base::FieldValue::TextList(svs) => {
223                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
224                        }
225                        _ => {}
226                    }
227                }
228                "ExcIEEEST3A.thetap" => {
229                    match val {
230                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.thetap = Some(v); } }
231                        crate::base::FieldValue::TextList(svs) => {
232                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.thetap = Some(v); } }
233                        }
234                        _ => {}
235                    }
236                }
237                "ExcIEEEST3A.tm" => {
238                    match val {
239                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tm = Some(v); } }
240                        crate::base::FieldValue::TextList(svs) => {
241                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tm = Some(v); } }
242                        }
243                        _ => {}
244                    }
245                }
246                "ExcIEEEST3A.vbmax" => {
247                    match val {
248                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vbmax = Some(v); } }
249                        crate::base::FieldValue::TextList(svs) => {
250                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vbmax = Some(v); } }
251                        }
252                        _ => {}
253                    }
254                }
255                "ExcIEEEST3A.vgmax" => {
256                    match val {
257                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vgmax = Some(v); } }
258                        crate::base::FieldValue::TextList(svs) => {
259                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vgmax = Some(v); } }
260                        }
261                        _ => {}
262                    }
263                }
264                "ExcIEEEST3A.vimax" => {
265                    match val {
266                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vimax = Some(v); } }
267                        crate::base::FieldValue::TextList(svs) => {
268                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vimax = Some(v); } }
269                        }
270                        _ => {}
271                    }
272                }
273                "ExcIEEEST3A.vimin" => {
274                    match val {
275                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vimin = Some(v); } }
276                        crate::base::FieldValue::TextList(svs) => {
277                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vimin = Some(v); } }
278                        }
279                        _ => {}
280                    }
281                }
282                "ExcIEEEST3A.vmmax" => {
283                    match val {
284                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vmmax = Some(v); } }
285                        crate::base::FieldValue::TextList(svs) => {
286                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vmmax = Some(v); } }
287                        }
288                        _ => {}
289                    }
290                }
291                "ExcIEEEST3A.vmmin" => {
292                    match val {
293                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vmmin = Some(v); } }
294                        crate::base::FieldValue::TextList(svs) => {
295                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vmmin = Some(v); } }
296                        }
297                        _ => {}
298                    }
299                }
300                "ExcIEEEST3A.vrmax" => {
301                    match val {
302                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
303                        crate::base::FieldValue::TextList(svs) => {
304                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
305                        }
306                        _ => {}
307                    }
308                }
309                "ExcIEEEST3A.vrmin" => {
310                    match val {
311                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
312                        crate::base::FieldValue::TextList(svs) => {
313                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
314                        }
315                        _ => {}
316                    }
317                }
318                "ExcIEEEST3A.xl" => {
319                    match val {
320                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.xl = Some(v); } }
321                        crate::base::FieldValue::TextList(svs) => {
322                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.xl = Some(v); } }
323                        }
324                        _ => {}
325                    }
326                }
327                "ExcitationSystemDynamics.SynchronousMachineDynamics" => {
328                    if let crate::base::FieldValue::Resource(sv) = val {
329                        obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
330                    }
331                }
332                "DynamicsFunctionBlock.enabled" => {
333                    match val {
334                        crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
335                        crate::base::FieldValue::TextList(svs) => {
336                            if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
337                        }
338                        _ => {}
339                    }
340                }
341                "IdentifiedObject.description" => {
342                    match val {
343                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
344                        crate::base::FieldValue::TextList(svs) => {
345                            if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
346                        }
347                        _ => {}
348                    }
349                }
350                "IdentifiedObject.energyIdentCodeEic" => {
351                    match val {
352                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
353                        crate::base::FieldValue::TextList(svs) => {
354                            if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
355                        }
356                        _ => {}
357                    }
358                }
359                "IdentifiedObject.mRID" => {
360                    match val {
361                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
362                        crate::base::FieldValue::TextList(svs) => {
363                            if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
364                        }
365                        _ => {}
366                    }
367                }
368                "IdentifiedObject.name" => {
369                    match val {
370                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
371                        crate::base::FieldValue::TextList(svs) => {
372                            if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
373                        }
374                        _ => {}
375                    }
376                }
377                "IdentifiedObject.shortName" => {
378                    match val {
379                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
380                        crate::base::FieldValue::TextList(svs) => {
381                            if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
382                        }
383                        _ => {}
384                    }
385                }
386                _ => {}
387            }
388        }
389        obj
390    }
391}