Skip to main content

cimstructs/
ExcIEEEDC2A.rs

1/// IEEE 421.5-2005 type DC2A model. This model represents field-controlled DC commutator exciters with continuously acting voltage regulators having supplies obtained from the generator or auxiliary bus. It differs from the type DC1A model only in the voltage regulator output limits, which are now proportional to terminal voltage VT. It is representative of solid-state replacements for various forms of older mechanical and rotating amplifier regulating equipment connected to DC commutator exciters. Reference: IEEE 421.5-2005, 5.2.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcIEEEDC2A {
4    #[serde(flatten)]
5    pub base: super::ExcitationSystemDynamics,
6    /// Exciter voltage at which exciter saturation is defined (EFD1) (> 0). Typical value = 3,05.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub efd1: Option<f64>,
9    /// Exciter voltage at which exciter saturation is defined (EFD2) (> 0). Typical value = 2,29.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub efd2: Option<f64>,
12    /// (exclim). IEEE standard is ambiguous about lower limit on exciter output. Typical value = - 999 which means that there is no limit applied.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub exclim: Option<f64>,
15    /// Voltage regulator gain (KA) (> 0). Typical value = 300.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub ka: 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 gain (KF) (>= 0). Typical value = 0,1.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub kf: Option<f64>,
24    /// Exciter saturation function value at the corresponding exciter voltage, EFD1 (SE[EFD1]) (>= 0). Typical value = 0,279.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub seefd1: Option<f64>,
27    /// Exciter saturation function value at the corresponding exciter voltage, EFD2 (SE[EFD2]) (>= 0). Typical value = 0,117.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub seefd2: Option<f64>,
30    /// Voltage regulator time constant (TA) (> 0). Typical value = 0,01.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub ta: Option<f64>,
33    /// Voltage regulator time constant (TB) (>= 0). Typical value = 0.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub tb: Option<f64>,
36    /// Voltage regulator time constant (TC) (>= 0). Typical value = 0.
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,33.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub te: Option<f64>,
42    /// Excitation control system stabilizer time constant (TF) (> 0). Typical value = 0,675.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub tf: Option<f64>,
45    /// UEL input (uelin). true = input is connected to the HV gate false = input connects to the error signal. Typical value = true.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub uelin: Option<bool>,
48    /// Maximum voltage regulator output (VRMAX)(> ExcIEEEDC2A.vrmin). Typical value = 4,95.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub vrmax: Option<f64>,
51    /// Minimum voltage regulator output (VRMIN) (< 0 and < ExcIEEEDC2A.vrmax). Typical value = -4,9.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub vrmin: Option<f64>,
54}
55impl crate::base::CimElement for ExcIEEEDC2A {
56    fn mrid(&self) -> &str { &self.base.base.base.id }
57    fn type_name(&self) -> &'static str { "ExcIEEEDC2A" }
58    fn as_any(&self) -> &dyn std::any::Any { self }
59    fn to_json_value(&self) -> serde_json::Value {
60        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
61    }
62    fn to_block(&self) -> crate::base::RdfBlock {
63        let mut block = self.base.to_block();
64        block.type_name = "ExcIEEEDC2A".to_string();
65        if let Some(v) = self.efd1 {
66            block.fields.insert("ExcIEEEDC2A.efd1".into(), crate::base::FieldValue::Text(v.to_string()));
67        }
68        if let Some(v) = self.efd2 {
69            block.fields.insert("ExcIEEEDC2A.efd2".into(), crate::base::FieldValue::Text(v.to_string()));
70        }
71        if let Some(v) = self.exclim {
72            block.fields.insert("ExcIEEEDC2A.exclim".into(), crate::base::FieldValue::Text(v.to_string()));
73        }
74        if let Some(v) = self.ka {
75            block.fields.insert("ExcIEEEDC2A.ka".into(), crate::base::FieldValue::Text(v.to_string()));
76        }
77        if let Some(v) = self.ke {
78            block.fields.insert("ExcIEEEDC2A.ke".into(), crate::base::FieldValue::Text(v.to_string()));
79        }
80        if let Some(v) = self.kf {
81            block.fields.insert("ExcIEEEDC2A.kf".into(), crate::base::FieldValue::Text(v.to_string()));
82        }
83        if let Some(v) = self.seefd1 {
84            block.fields.insert("ExcIEEEDC2A.seefd1".into(), crate::base::FieldValue::Text(v.to_string()));
85        }
86        if let Some(v) = self.seefd2 {
87            block.fields.insert("ExcIEEEDC2A.seefd2".into(), crate::base::FieldValue::Text(v.to_string()));
88        }
89        if let Some(v) = self.ta {
90            block.fields.insert("ExcIEEEDC2A.ta".into(), crate::base::FieldValue::Text(v.to_string()));
91        }
92        if let Some(v) = self.tb {
93            block.fields.insert("ExcIEEEDC2A.tb".into(), crate::base::FieldValue::Text(v.to_string()));
94        }
95        if let Some(v) = self.tc {
96            block.fields.insert("ExcIEEEDC2A.tc".into(), crate::base::FieldValue::Text(v.to_string()));
97        }
98        if let Some(v) = self.te {
99            block.fields.insert("ExcIEEEDC2A.te".into(), crate::base::FieldValue::Text(v.to_string()));
100        }
101        if let Some(v) = self.tf {
102            block.fields.insert("ExcIEEEDC2A.tf".into(), crate::base::FieldValue::Text(v.to_string()));
103        }
104        if let Some(v) = self.uelin {
105            block.fields.insert("ExcIEEEDC2A.uelin".into(), crate::base::FieldValue::Text(v.to_string()));
106        }
107        if let Some(v) = self.vrmax {
108            block.fields.insert("ExcIEEEDC2A.vrmax".into(), crate::base::FieldValue::Text(v.to_string()));
109        }
110        if let Some(v) = self.vrmin {
111            block.fields.insert("ExcIEEEDC2A.vrmin".into(), crate::base::FieldValue::Text(v.to_string()));
112        }
113        block
114    }
115}
116
117impl ExcIEEEDC2A {
118    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
119        let mut obj = Self::default();
120        obj.base.base.base.id.clone_from(&b.mrid);
121        for (key, val) in &b.fields {
122            match key.as_str() {
123                "ExcIEEEDC2A.efd1" => {
124                    match val {
125                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.efd1 = Some(v); } }
126                        crate::base::FieldValue::TextList(svs) => {
127                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.efd1 = Some(v); } }
128                        }
129                        _ => {}
130                    }
131                }
132                "ExcIEEEDC2A.efd2" => {
133                    match val {
134                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.efd2 = Some(v); } }
135                        crate::base::FieldValue::TextList(svs) => {
136                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.efd2 = Some(v); } }
137                        }
138                        _ => {}
139                    }
140                }
141                "ExcIEEEDC2A.exclim" => {
142                    match val {
143                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.exclim = Some(v); } }
144                        crate::base::FieldValue::TextList(svs) => {
145                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.exclim = Some(v); } }
146                        }
147                        _ => {}
148                    }
149                }
150                "ExcIEEEDC2A.ka" => {
151                    match val {
152                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
153                        crate::base::FieldValue::TextList(svs) => {
154                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
155                        }
156                        _ => {}
157                    }
158                }
159                "ExcIEEEDC2A.ke" => {
160                    match val {
161                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
162                        crate::base::FieldValue::TextList(svs) => {
163                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
164                        }
165                        _ => {}
166                    }
167                }
168                "ExcIEEEDC2A.kf" => {
169                    match val {
170                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kf = Some(v); } }
171                        crate::base::FieldValue::TextList(svs) => {
172                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kf = Some(v); } }
173                        }
174                        _ => {}
175                    }
176                }
177                "ExcIEEEDC2A.seefd1" => {
178                    match val {
179                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seefd1 = Some(v); } }
180                        crate::base::FieldValue::TextList(svs) => {
181                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seefd1 = Some(v); } }
182                        }
183                        _ => {}
184                    }
185                }
186                "ExcIEEEDC2A.seefd2" => {
187                    match val {
188                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seefd2 = Some(v); } }
189                        crate::base::FieldValue::TextList(svs) => {
190                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seefd2 = Some(v); } }
191                        }
192                        _ => {}
193                    }
194                }
195                "ExcIEEEDC2A.ta" => {
196                    match val {
197                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
198                        crate::base::FieldValue::TextList(svs) => {
199                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
200                        }
201                        _ => {}
202                    }
203                }
204                "ExcIEEEDC2A.tb" => {
205                    match val {
206                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
207                        crate::base::FieldValue::TextList(svs) => {
208                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
209                        }
210                        _ => {}
211                    }
212                }
213                "ExcIEEEDC2A.tc" => {
214                    match val {
215                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
216                        crate::base::FieldValue::TextList(svs) => {
217                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
218                        }
219                        _ => {}
220                    }
221                }
222                "ExcIEEEDC2A.te" => {
223                    match val {
224                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
225                        crate::base::FieldValue::TextList(svs) => {
226                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
227                        }
228                        _ => {}
229                    }
230                }
231                "ExcIEEEDC2A.tf" => {
232                    match val {
233                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
234                        crate::base::FieldValue::TextList(svs) => {
235                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
236                        }
237                        _ => {}
238                    }
239                }
240                "ExcIEEEDC2A.uelin" => {
241                    match val {
242                        crate::base::FieldValue::Text(sv) => { obj.uelin = Some(sv.trim() == "true"); }
243                        crate::base::FieldValue::TextList(svs) => {
244                            if let Some(sv) = svs.last() { obj.uelin = Some(sv.trim() == "true"); }
245                        }
246                        _ => {}
247                    }
248                }
249                "ExcIEEEDC2A.vrmax" => {
250                    match val {
251                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
252                        crate::base::FieldValue::TextList(svs) => {
253                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
254                        }
255                        _ => {}
256                    }
257                }
258                "ExcIEEEDC2A.vrmin" => {
259                    match val {
260                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
261                        crate::base::FieldValue::TextList(svs) => {
262                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
263                        }
264                        _ => {}
265                    }
266                }
267                "ExcitationSystemDynamics.SynchronousMachineDynamics" => {
268                    if let crate::base::FieldValue::Resource(sv) = val {
269                        obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
270                    }
271                }
272                "DynamicsFunctionBlock.enabled" => {
273                    match val {
274                        crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
275                        crate::base::FieldValue::TextList(svs) => {
276                            if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
277                        }
278                        _ => {}
279                    }
280                }
281                "IdentifiedObject.description" => {
282                    match val {
283                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
284                        crate::base::FieldValue::TextList(svs) => {
285                            if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
286                        }
287                        _ => {}
288                    }
289                }
290                "IdentifiedObject.energyIdentCodeEic" => {
291                    match val {
292                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
293                        crate::base::FieldValue::TextList(svs) => {
294                            if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
295                        }
296                        _ => {}
297                    }
298                }
299                "IdentifiedObject.mRID" => {
300                    match val {
301                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
302                        crate::base::FieldValue::TextList(svs) => {
303                            if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
304                        }
305                        _ => {}
306                    }
307                }
308                "IdentifiedObject.name" => {
309                    match val {
310                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
311                        crate::base::FieldValue::TextList(svs) => {
312                            if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
313                        }
314                        _ => {}
315                    }
316                }
317                "IdentifiedObject.shortName" => {
318                    match val {
319                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
320                        crate::base::FieldValue::TextList(svs) => {
321                            if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
322                        }
323                        _ => {}
324                    }
325                }
326                _ => {}
327            }
328        }
329        obj
330    }
331}