Skip to main content

cimstructs/
ExcIEEEST2A.rs

1/// IEEE 421.5-2005 type ST2A model. Some static systems use both current and voltage sources (generator terminal quantities) to comprise the power source. The regulator controls the exciter output through controlled saturation of the power transformer components. These compound-source rectifier excitation systems are designated type ST2A and are represented by ExcIEEEST2A. Reference: IEEE 421.5-2005, 7.2.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcIEEEST2A {
4    #[serde(flatten)]
5    pub base: super::ExcitationSystemDynamics,
6    /// Maximum field voltage (EFDMax) (>= 0). Typical value = 99.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub efdmax: Option<f64>,
9    /// Voltage regulator gain (KA) (> 0). Typical value = 120.
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 = 1,82.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub kc: Option<f64>,
15    /// Exciter constant related to self-excited field (KE). Typical value = 1.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub ke: Option<f64>,
18    /// Excitation control system stabilizer gains (KF) (>= 0). Typical value = 0,05.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub kf: Option<f64>,
21    /// Potential circuit gain coefficient (KI) (>= 0). Typical value = 8.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub ki: Option<f64>,
24    /// Potential circuit gain coefficient (KP) (>= 0). Typical value = 4,88.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub kp: Option<f64>,
27    /// Voltage regulator time constant (TA) (> 0). Typical value = 0,15.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub ta: Option<f64>,
30    /// Exciter time constant, integration rate associated with exciter control (TE) (> 0). Typical value = 0,5.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub te: Option<f64>,
33    /// Excitation control system stabilizer time constant (TF) (>= 0). Typical value = 1.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub tf: Option<f64>,
36    /// UEL input (UELin). true = HV gate false = add to error signal. Typical value = true.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub uelin: Option<bool>,
39    /// Maximum voltage regulator outputs (VRMAX) (> 0). Typical value = 1.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub vrmax: Option<f64>,
42    /// Minimum voltage regulator outputs (VRMIN) (<= 0). Typical value = 0.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub vrmin: Option<f64>,
45}
46impl crate::base::CimElement for ExcIEEEST2A {
47    fn mrid(&self) -> &str { &self.base.base.base.id }
48    fn type_name(&self) -> &'static str { "ExcIEEEST2A" }
49    fn as_any(&self) -> &dyn std::any::Any { self }
50    fn to_json_value(&self) -> serde_json::Value {
51        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
52    }
53    fn to_block(&self) -> crate::base::RdfBlock {
54        let mut block = self.base.to_block();
55        block.type_name = "ExcIEEEST2A".to_string();
56        if let Some(v) = self.efdmax {
57            block.fields.insert("ExcIEEEST2A.efdmax".into(), crate::base::FieldValue::Text(v.to_string()));
58        }
59        if let Some(v) = self.ka {
60            block.fields.insert("ExcIEEEST2A.ka".into(), crate::base::FieldValue::Text(v.to_string()));
61        }
62        if let Some(v) = self.kc {
63            block.fields.insert("ExcIEEEST2A.kc".into(), crate::base::FieldValue::Text(v.to_string()));
64        }
65        if let Some(v) = self.ke {
66            block.fields.insert("ExcIEEEST2A.ke".into(), crate::base::FieldValue::Text(v.to_string()));
67        }
68        if let Some(v) = self.kf {
69            block.fields.insert("ExcIEEEST2A.kf".into(), crate::base::FieldValue::Text(v.to_string()));
70        }
71        if let Some(v) = self.ki {
72            block.fields.insert("ExcIEEEST2A.ki".into(), crate::base::FieldValue::Text(v.to_string()));
73        }
74        if let Some(v) = self.kp {
75            block.fields.insert("ExcIEEEST2A.kp".into(), crate::base::FieldValue::Text(v.to_string()));
76        }
77        if let Some(v) = self.ta {
78            block.fields.insert("ExcIEEEST2A.ta".into(), crate::base::FieldValue::Text(v.to_string()));
79        }
80        if let Some(v) = self.te {
81            block.fields.insert("ExcIEEEST2A.te".into(), crate::base::FieldValue::Text(v.to_string()));
82        }
83        if let Some(v) = self.tf {
84            block.fields.insert("ExcIEEEST2A.tf".into(), crate::base::FieldValue::Text(v.to_string()));
85        }
86        if let Some(v) = self.uelin {
87            block.fields.insert("ExcIEEEST2A.uelin".into(), crate::base::FieldValue::Text(v.to_string()));
88        }
89        if let Some(v) = self.vrmax {
90            block.fields.insert("ExcIEEEST2A.vrmax".into(), crate::base::FieldValue::Text(v.to_string()));
91        }
92        if let Some(v) = self.vrmin {
93            block.fields.insert("ExcIEEEST2A.vrmin".into(), crate::base::FieldValue::Text(v.to_string()));
94        }
95        block
96    }
97}
98
99impl ExcIEEEST2A {
100    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
101        let mut obj = Self::default();
102        obj.base.base.base.id.clone_from(&b.mrid);
103        for (key, val) in &b.fields {
104            match key.as_str() {
105                "ExcIEEEST2A.efdmax" => {
106                    match val {
107                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.efdmax = Some(v); } }
108                        crate::base::FieldValue::TextList(svs) => {
109                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.efdmax = Some(v); } }
110                        }
111                        _ => {}
112                    }
113                }
114                "ExcIEEEST2A.ka" => {
115                    match val {
116                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
117                        crate::base::FieldValue::TextList(svs) => {
118                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ka = Some(v); } }
119                        }
120                        _ => {}
121                    }
122                }
123                "ExcIEEEST2A.kc" => {
124                    match val {
125                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
126                        crate::base::FieldValue::TextList(svs) => {
127                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kc = Some(v); } }
128                        }
129                        _ => {}
130                    }
131                }
132                "ExcIEEEST2A.ke" => {
133                    match val {
134                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
135                        crate::base::FieldValue::TextList(svs) => {
136                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
137                        }
138                        _ => {}
139                    }
140                }
141                "ExcIEEEST2A.kf" => {
142                    match val {
143                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kf = Some(v); } }
144                        crate::base::FieldValue::TextList(svs) => {
145                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kf = Some(v); } }
146                        }
147                        _ => {}
148                    }
149                }
150                "ExcIEEEST2A.ki" => {
151                    match val {
152                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ki = Some(v); } }
153                        crate::base::FieldValue::TextList(svs) => {
154                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ki = Some(v); } }
155                        }
156                        _ => {}
157                    }
158                }
159                "ExcIEEEST2A.kp" => {
160                    match val {
161                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kp = Some(v); } }
162                        crate::base::FieldValue::TextList(svs) => {
163                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kp = Some(v); } }
164                        }
165                        _ => {}
166                    }
167                }
168                "ExcIEEEST2A.ta" => {
169                    match val {
170                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
171                        crate::base::FieldValue::TextList(svs) => {
172                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ta = Some(v); } }
173                        }
174                        _ => {}
175                    }
176                }
177                "ExcIEEEST2A.te" => {
178                    match val {
179                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
180                        crate::base::FieldValue::TextList(svs) => {
181                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
182                        }
183                        _ => {}
184                    }
185                }
186                "ExcIEEEST2A.tf" => {
187                    match val {
188                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
189                        crate::base::FieldValue::TextList(svs) => {
190                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
191                        }
192                        _ => {}
193                    }
194                }
195                "ExcIEEEST2A.uelin" => {
196                    match val {
197                        crate::base::FieldValue::Text(sv) => { obj.uelin = Some(sv.trim() == "true"); }
198                        crate::base::FieldValue::TextList(svs) => {
199                            if let Some(sv) = svs.last() { obj.uelin = Some(sv.trim() == "true"); }
200                        }
201                        _ => {}
202                    }
203                }
204                "ExcIEEEST2A.vrmax" => {
205                    match val {
206                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
207                        crate::base::FieldValue::TextList(svs) => {
208                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
209                        }
210                        _ => {}
211                    }
212                }
213                "ExcIEEEST2A.vrmin" => {
214                    match val {
215                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
216                        crate::base::FieldValue::TextList(svs) => {
217                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
218                        }
219                        _ => {}
220                    }
221                }
222                "ExcitationSystemDynamics.SynchronousMachineDynamics" => {
223                    if let crate::base::FieldValue::Resource(sv) = val {
224                        obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
225                    }
226                }
227                "DynamicsFunctionBlock.enabled" => {
228                    match val {
229                        crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
230                        crate::base::FieldValue::TextList(svs) => {
231                            if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
232                        }
233                        _ => {}
234                    }
235                }
236                "IdentifiedObject.description" => {
237                    match val {
238                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
239                        crate::base::FieldValue::TextList(svs) => {
240                            if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
241                        }
242                        _ => {}
243                    }
244                }
245                "IdentifiedObject.energyIdentCodeEic" => {
246                    match val {
247                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
248                        crate::base::FieldValue::TextList(svs) => {
249                            if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
250                        }
251                        _ => {}
252                    }
253                }
254                "IdentifiedObject.mRID" => {
255                    match val {
256                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
257                        crate::base::FieldValue::TextList(svs) => {
258                            if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
259                        }
260                        _ => {}
261                    }
262                }
263                "IdentifiedObject.name" => {
264                    match val {
265                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
266                        crate::base::FieldValue::TextList(svs) => {
267                            if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
268                        }
269                        _ => {}
270                    }
271                }
272                "IdentifiedObject.shortName" => {
273                    match val {
274                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
275                        crate::base::FieldValue::TextList(svs) => {
276                            if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
277                        }
278                        _ => {}
279                    }
280                }
281                _ => {}
282            }
283        }
284        obj
285    }
286}