Skip to main content

cimstructs/
ExcIEEEST7B.rs

1/// IEEE 421.5-2005 type ST7B model. This model is representative of static potential-source excitation systems. In this system, the AVR consists of a PI voltage regulator. A phase lead-lag filter in series allows the introduction of a derivative function, typically used with brushless excitation systems. In that case, the regulator is of the PID type. In addition, the terminal voltage channel includes a phase lead-lag filter. The AVR includes the appropriate inputs on its reference for overexcitation limiter (OEL1), underexcitation limiter (UEL), stator current limiter (SCL), and current compensator (DROOP). All these limitations, when they work at voltage reference level, keep the PSS (VS signal from PSS) in operation. However, the UEL limitation can also be transferred to the high value (HV) gate acting on the output signal. In addition, the output signal passes through a low value (LV) gate for a ceiling overexcitation limiter (OEL2). Reference: IEEE 421.5-2005, 7.7.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcIEEEST7B {
4    #[serde(flatten)]
5    pub base: super::ExcitationSystemDynamics,
6    /// High-value gate feedback gain (KH) (>= 0). Typical value = 1.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub kh: Option<f64>,
9    /// Voltage regulator integral gain (KIA) (>= 0). Typical value = 1.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub kia: Option<f64>,
12    /// Low-value gate feedback gain (KL) (>= 0). Typical value = 1.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub kl: Option<f64>,
15    /// Voltage regulator proportional gain (KPA) (> 0). Typical value = 40.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub kpa: Option<f64>,
18    /// OEL input selector (OELin). Typical value = noOELinput.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub oelin: Option<super::base::UriRef>,
21    /// Regulator lag time constant (TB) (>= 0). Typical value = 1.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub tb: Option<f64>,
24    /// Regulator lead time constant (TC) (>= 0). Typical value = 1.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub tc: Option<f64>,
27    /// Excitation control system stabilizer time constant (TF) (>= 0). Typical value = 1.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub tf: Option<f64>,
30    /// Feedback time constant of inner loop field voltage regulator (TG) (>= 0). Typical value = 1.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub tg: Option<f64>,
33    /// Feedback time constant (TIA) (>= 0). Typical value = 3.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub tia: Option<f64>,
36    /// UEL input selector (UELin). Typical value = noUELinput.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub uelin: Option<super::base::UriRef>,
39    /// Maximum voltage reference signal (VMAX) (> 0 and > ExcIEEEST7B.vmin). Typical value = 1,1.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub vmax: Option<f64>,
42    /// Minimum voltage reference signal (VMIN) (> 0 and < ExcIEEEST7B.vmax). Typical value = 0,9.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub vmin: Option<f64>,
45    /// Maximum voltage regulator output (VRMAX) (> 0). Typical value = 5.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub vrmax: Option<f64>,
48    /// Minimum voltage regulator output (VRMIN) (< 0). Typical value = -4,5.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub vrmin: Option<f64>,
51}
52impl crate::base::CimElement for ExcIEEEST7B {
53    fn mrid(&self) -> &str { &self.base.base.base.id }
54    fn type_name(&self) -> &'static str { "ExcIEEEST7B" }
55    fn as_any(&self) -> &dyn std::any::Any { self }
56    fn to_json_value(&self) -> serde_json::Value {
57        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
58    }
59    fn to_block(&self) -> crate::base::RdfBlock {
60        let mut block = self.base.to_block();
61        block.type_name = "ExcIEEEST7B".to_string();
62        if let Some(v) = self.kh {
63            block.fields.insert("ExcIEEEST7B.kh".into(), crate::base::FieldValue::Text(v.to_string()));
64        }
65        if let Some(v) = self.kia {
66            block.fields.insert("ExcIEEEST7B.kia".into(), crate::base::FieldValue::Text(v.to_string()));
67        }
68        if let Some(v) = self.kl {
69            block.fields.insert("ExcIEEEST7B.kl".into(), crate::base::FieldValue::Text(v.to_string()));
70        }
71        if let Some(v) = self.kpa {
72            block.fields.insert("ExcIEEEST7B.kpa".into(), crate::base::FieldValue::Text(v.to_string()));
73        }
74        if let Some(ref v) = self.oelin {
75            block.fields.insert("ExcIEEEST7B.oelin".into(), crate::base::FieldValue::Resource(v.uri.clone()));
76        }
77        if let Some(v) = self.tb {
78            block.fields.insert("ExcIEEEST7B.tb".into(), crate::base::FieldValue::Text(v.to_string()));
79        }
80        if let Some(v) = self.tc {
81            block.fields.insert("ExcIEEEST7B.tc".into(), crate::base::FieldValue::Text(v.to_string()));
82        }
83        if let Some(v) = self.tf {
84            block.fields.insert("ExcIEEEST7B.tf".into(), crate::base::FieldValue::Text(v.to_string()));
85        }
86        if let Some(v) = self.tg {
87            block.fields.insert("ExcIEEEST7B.tg".into(), crate::base::FieldValue::Text(v.to_string()));
88        }
89        if let Some(v) = self.tia {
90            block.fields.insert("ExcIEEEST7B.tia".into(), crate::base::FieldValue::Text(v.to_string()));
91        }
92        if let Some(ref v) = self.uelin {
93            block.fields.insert("ExcIEEEST7B.uelin".into(), crate::base::FieldValue::Resource(v.uri.clone()));
94        }
95        if let Some(v) = self.vmax {
96            block.fields.insert("ExcIEEEST7B.vmax".into(), crate::base::FieldValue::Text(v.to_string()));
97        }
98        if let Some(v) = self.vmin {
99            block.fields.insert("ExcIEEEST7B.vmin".into(), crate::base::FieldValue::Text(v.to_string()));
100        }
101        if let Some(v) = self.vrmax {
102            block.fields.insert("ExcIEEEST7B.vrmax".into(), crate::base::FieldValue::Text(v.to_string()));
103        }
104        if let Some(v) = self.vrmin {
105            block.fields.insert("ExcIEEEST7B.vrmin".into(), crate::base::FieldValue::Text(v.to_string()));
106        }
107        block
108    }
109}
110
111impl ExcIEEEST7B {
112    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
113        let mut obj = Self::default();
114        obj.base.base.base.id.clone_from(&b.mrid);
115        for (key, val) in &b.fields {
116            match key.as_str() {
117                "ExcIEEEST7B.kh" => {
118                    match val {
119                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kh = Some(v); } }
120                        crate::base::FieldValue::TextList(svs) => {
121                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kh = Some(v); } }
122                        }
123                        _ => {}
124                    }
125                }
126                "ExcIEEEST7B.kia" => {
127                    match val {
128                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kia = Some(v); } }
129                        crate::base::FieldValue::TextList(svs) => {
130                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kia = Some(v); } }
131                        }
132                        _ => {}
133                    }
134                }
135                "ExcIEEEST7B.kl" => {
136                    match val {
137                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kl = Some(v); } }
138                        crate::base::FieldValue::TextList(svs) => {
139                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kl = Some(v); } }
140                        }
141                        _ => {}
142                    }
143                }
144                "ExcIEEEST7B.kpa" => {
145                    match val {
146                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kpa = Some(v); } }
147                        crate::base::FieldValue::TextList(svs) => {
148                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kpa = Some(v); } }
149                        }
150                        _ => {}
151                    }
152                }
153                "ExcIEEEST7B.oelin" => {
154                    if let crate::base::FieldValue::Resource(sv) = val {
155                        obj.oelin = Some(crate::base::UriRef { uri: sv.clone() });
156                    }
157                }
158                "ExcIEEEST7B.tb" => {
159                    match val {
160                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
161                        crate::base::FieldValue::TextList(svs) => {
162                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
163                        }
164                        _ => {}
165                    }
166                }
167                "ExcIEEEST7B.tc" => {
168                    match val {
169                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
170                        crate::base::FieldValue::TextList(svs) => {
171                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
172                        }
173                        _ => {}
174                    }
175                }
176                "ExcIEEEST7B.tf" => {
177                    match val {
178                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
179                        crate::base::FieldValue::TextList(svs) => {
180                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
181                        }
182                        _ => {}
183                    }
184                }
185                "ExcIEEEST7B.tg" => {
186                    match val {
187                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tg = Some(v); } }
188                        crate::base::FieldValue::TextList(svs) => {
189                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tg = Some(v); } }
190                        }
191                        _ => {}
192                    }
193                }
194                "ExcIEEEST7B.tia" => {
195                    match val {
196                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tia = Some(v); } }
197                        crate::base::FieldValue::TextList(svs) => {
198                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tia = Some(v); } }
199                        }
200                        _ => {}
201                    }
202                }
203                "ExcIEEEST7B.uelin" => {
204                    if let crate::base::FieldValue::Resource(sv) = val {
205                        obj.uelin = Some(crate::base::UriRef { uri: sv.clone() });
206                    }
207                }
208                "ExcIEEEST7B.vmax" => {
209                    match val {
210                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vmax = Some(v); } }
211                        crate::base::FieldValue::TextList(svs) => {
212                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vmax = Some(v); } }
213                        }
214                        _ => {}
215                    }
216                }
217                "ExcIEEEST7B.vmin" => {
218                    match val {
219                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vmin = Some(v); } }
220                        crate::base::FieldValue::TextList(svs) => {
221                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vmin = Some(v); } }
222                        }
223                        _ => {}
224                    }
225                }
226                "ExcIEEEST7B.vrmax" => {
227                    match val {
228                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
229                        crate::base::FieldValue::TextList(svs) => {
230                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
231                        }
232                        _ => {}
233                    }
234                }
235                "ExcIEEEST7B.vrmin" => {
236                    match val {
237                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
238                        crate::base::FieldValue::TextList(svs) => {
239                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
240                        }
241                        _ => {}
242                    }
243                }
244                "ExcitationSystemDynamics.SynchronousMachineDynamics" => {
245                    if let crate::base::FieldValue::Resource(sv) = val {
246                        obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
247                    }
248                }
249                "DynamicsFunctionBlock.enabled" => {
250                    match val {
251                        crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
252                        crate::base::FieldValue::TextList(svs) => {
253                            if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
254                        }
255                        _ => {}
256                    }
257                }
258                "IdentifiedObject.description" => {
259                    match val {
260                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
261                        crate::base::FieldValue::TextList(svs) => {
262                            if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
263                        }
264                        _ => {}
265                    }
266                }
267                "IdentifiedObject.energyIdentCodeEic" => {
268                    match val {
269                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
270                        crate::base::FieldValue::TextList(svs) => {
271                            if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
272                        }
273                        _ => {}
274                    }
275                }
276                "IdentifiedObject.mRID" => {
277                    match val {
278                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
279                        crate::base::FieldValue::TextList(svs) => {
280                            if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
281                        }
282                        _ => {}
283                    }
284                }
285                "IdentifiedObject.name" => {
286                    match val {
287                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
288                        crate::base::FieldValue::TextList(svs) => {
289                            if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
290                        }
291                        _ => {}
292                    }
293                }
294                "IdentifiedObject.shortName" => {
295                    match val {
296                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
297                        crate::base::FieldValue::TextList(svs) => {
298                            if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
299                        }
300                        _ => {}
301                    }
302                }
303                _ => {}
304            }
305        }
306        obj
307    }
308}