Skip to main content

cimstructs/
ExcST7B.rs

1/// Modified IEEE ST7B static excitation system without stator current limiter (SCL) and current compensator (DROOP) inputs.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcST7B {
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    /// Rectifier firing time constant (Ts) (>= 0). Typical value = 0.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub ts: Option<f64>,
39    /// UEL input selector (UELin). Typical value = noUELinput.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub uelin: Option<super::base::UriRef>,
42    /// Maximum voltage reference signal (Vmax) (> 0 and > ExcST7B.vmin)). Typical value = 1,1.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub vmax: Option<f64>,
45    /// Minimum voltage reference signal (Vmin) (> 0 and < ExcST7B.vmax). Typical value = 0,9.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub vmin: Option<f64>,
48    /// Maximum voltage regulator output (Vrmax) (> 0). Typical value = 5.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub vrmax: Option<f64>,
51    /// Minimum voltage regulator output (Vrmin) (< 0). Typical value = -4,5.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub vrmin: Option<f64>,
54}
55impl crate::base::CimElement for ExcST7B {
56    fn mrid(&self) -> &str { &self.base.base.base.id }
57    fn type_name(&self) -> &'static str { "ExcST7B" }
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 = "ExcST7B".to_string();
65        if let Some(v) = self.kh {
66            block.fields.insert("ExcST7B.kh".into(), crate::base::FieldValue::Text(v.to_string()));
67        }
68        if let Some(v) = self.kia {
69            block.fields.insert("ExcST7B.kia".into(), crate::base::FieldValue::Text(v.to_string()));
70        }
71        if let Some(v) = self.kl {
72            block.fields.insert("ExcST7B.kl".into(), crate::base::FieldValue::Text(v.to_string()));
73        }
74        if let Some(v) = self.kpa {
75            block.fields.insert("ExcST7B.kpa".into(), crate::base::FieldValue::Text(v.to_string()));
76        }
77        if let Some(ref v) = self.oelin {
78            block.fields.insert("ExcST7B.oelin".into(), crate::base::FieldValue::Resource(v.uri.clone()));
79        }
80        if let Some(v) = self.tb {
81            block.fields.insert("ExcST7B.tb".into(), crate::base::FieldValue::Text(v.to_string()));
82        }
83        if let Some(v) = self.tc {
84            block.fields.insert("ExcST7B.tc".into(), crate::base::FieldValue::Text(v.to_string()));
85        }
86        if let Some(v) = self.tf {
87            block.fields.insert("ExcST7B.tf".into(), crate::base::FieldValue::Text(v.to_string()));
88        }
89        if let Some(v) = self.tg {
90            block.fields.insert("ExcST7B.tg".into(), crate::base::FieldValue::Text(v.to_string()));
91        }
92        if let Some(v) = self.tia {
93            block.fields.insert("ExcST7B.tia".into(), crate::base::FieldValue::Text(v.to_string()));
94        }
95        if let Some(v) = self.ts {
96            block.fields.insert("ExcST7B.ts".into(), crate::base::FieldValue::Text(v.to_string()));
97        }
98        if let Some(ref v) = self.uelin {
99            block.fields.insert("ExcST7B.uelin".into(), crate::base::FieldValue::Resource(v.uri.clone()));
100        }
101        if let Some(v) = self.vmax {
102            block.fields.insert("ExcST7B.vmax".into(), crate::base::FieldValue::Text(v.to_string()));
103        }
104        if let Some(v) = self.vmin {
105            block.fields.insert("ExcST7B.vmin".into(), crate::base::FieldValue::Text(v.to_string()));
106        }
107        if let Some(v) = self.vrmax {
108            block.fields.insert("ExcST7B.vrmax".into(), crate::base::FieldValue::Text(v.to_string()));
109        }
110        if let Some(v) = self.vrmin {
111            block.fields.insert("ExcST7B.vrmin".into(), crate::base::FieldValue::Text(v.to_string()));
112        }
113        block
114    }
115}
116
117impl ExcST7B {
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                "ExcST7B.kh" => {
124                    match val {
125                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kh = Some(v); } }
126                        crate::base::FieldValue::TextList(svs) => {
127                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kh = Some(v); } }
128                        }
129                        _ => {}
130                    }
131                }
132                "ExcST7B.kia" => {
133                    match val {
134                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kia = Some(v); } }
135                        crate::base::FieldValue::TextList(svs) => {
136                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kia = Some(v); } }
137                        }
138                        _ => {}
139                    }
140                }
141                "ExcST7B.kl" => {
142                    match val {
143                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kl = Some(v); } }
144                        crate::base::FieldValue::TextList(svs) => {
145                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kl = Some(v); } }
146                        }
147                        _ => {}
148                    }
149                }
150                "ExcST7B.kpa" => {
151                    match val {
152                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kpa = Some(v); } }
153                        crate::base::FieldValue::TextList(svs) => {
154                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kpa = Some(v); } }
155                        }
156                        _ => {}
157                    }
158                }
159                "ExcST7B.oelin" => {
160                    if let crate::base::FieldValue::Resource(sv) = val {
161                        obj.oelin = Some(crate::base::UriRef { uri: sv.clone() });
162                    }
163                }
164                "ExcST7B.tb" => {
165                    match val {
166                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
167                        crate::base::FieldValue::TextList(svs) => {
168                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tb = Some(v); } }
169                        }
170                        _ => {}
171                    }
172                }
173                "ExcST7B.tc" => {
174                    match val {
175                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
176                        crate::base::FieldValue::TextList(svs) => {
177                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
178                        }
179                        _ => {}
180                    }
181                }
182                "ExcST7B.tf" => {
183                    match val {
184                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
185                        crate::base::FieldValue::TextList(svs) => {
186                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tf = Some(v); } }
187                        }
188                        _ => {}
189                    }
190                }
191                "ExcST7B.tg" => {
192                    match val {
193                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tg = Some(v); } }
194                        crate::base::FieldValue::TextList(svs) => {
195                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tg = Some(v); } }
196                        }
197                        _ => {}
198                    }
199                }
200                "ExcST7B.tia" => {
201                    match val {
202                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tia = Some(v); } }
203                        crate::base::FieldValue::TextList(svs) => {
204                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tia = Some(v); } }
205                        }
206                        _ => {}
207                    }
208                }
209                "ExcST7B.ts" => {
210                    match val {
211                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ts = Some(v); } }
212                        crate::base::FieldValue::TextList(svs) => {
213                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ts = Some(v); } }
214                        }
215                        _ => {}
216                    }
217                }
218                "ExcST7B.uelin" => {
219                    if let crate::base::FieldValue::Resource(sv) = val {
220                        obj.uelin = Some(crate::base::UriRef { uri: sv.clone() });
221                    }
222                }
223                "ExcST7B.vmax" => {
224                    match val {
225                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vmax = Some(v); } }
226                        crate::base::FieldValue::TextList(svs) => {
227                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vmax = Some(v); } }
228                        }
229                        _ => {}
230                    }
231                }
232                "ExcST7B.vmin" => {
233                    match val {
234                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vmin = Some(v); } }
235                        crate::base::FieldValue::TextList(svs) => {
236                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vmin = Some(v); } }
237                        }
238                        _ => {}
239                    }
240                }
241                "ExcST7B.vrmax" => {
242                    match val {
243                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
244                        crate::base::FieldValue::TextList(svs) => {
245                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
246                        }
247                        _ => {}
248                    }
249                }
250                "ExcST7B.vrmin" => {
251                    match val {
252                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
253                        crate::base::FieldValue::TextList(svs) => {
254                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
255                        }
256                        _ => {}
257                    }
258                }
259                "ExcitationSystemDynamics.SynchronousMachineDynamics" => {
260                    if let crate::base::FieldValue::Resource(sv) = val {
261                        obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
262                    }
263                }
264                "DynamicsFunctionBlock.enabled" => {
265                    match val {
266                        crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
267                        crate::base::FieldValue::TextList(svs) => {
268                            if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
269                        }
270                        _ => {}
271                    }
272                }
273                "IdentifiedObject.description" => {
274                    match val {
275                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
276                        crate::base::FieldValue::TextList(svs) => {
277                            if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
278                        }
279                        _ => {}
280                    }
281                }
282                "IdentifiedObject.energyIdentCodeEic" => {
283                    match val {
284                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
285                        crate::base::FieldValue::TextList(svs) => {
286                            if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
287                        }
288                        _ => {}
289                    }
290                }
291                "IdentifiedObject.mRID" => {
292                    match val {
293                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
294                        crate::base::FieldValue::TextList(svs) => {
295                            if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
296                        }
297                        _ => {}
298                    }
299                }
300                "IdentifiedObject.name" => {
301                    match val {
302                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
303                        crate::base::FieldValue::TextList(svs) => {
304                            if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
305                        }
306                        _ => {}
307                    }
308                }
309                "IdentifiedObject.shortName" => {
310                    match val {
311                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
312                        crate::base::FieldValue::TextList(svs) => {
313                            if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
314                        }
315                        _ => {}
316                    }
317                }
318                _ => {}
319            }
320        }
321        obj
322    }
323}