Skip to main content

cimstructs/
ExcIEEEDC3A.rs

1/// IEEE 421.5-2005 type DC3A model. This model represents older systems, in particular those DC commutator exciters with non-continuously acting regulators that were commonly used before the development of the continuously acting varieties. These systems respond at basically two different rates, depending upon the magnitude of voltage error. For small errors, adjustment is made periodically with a signal to a motor-operated rheostat. Larger errors cause resistors to be quickly shorted or inserted and a strong forcing signal applied to the exciter. Continuous motion of the motor-operated rheostat occurs for these larger error signals, even though it is bypassed by contactor action. Reference: IEEE 421.5-2005, 5.3.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcIEEEDC3A {
4    #[serde(flatten)]
5    pub base: super::ExcitationSystemDynamics,
6    /// Exciter voltage at which exciter saturation is defined (EFD1) (> 0). Typical value = 3,375.
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 = 3,15.
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. true = a lower limit of zero is applied to integrator output false = a lower limit of zero is not applied to integrator output. Typical value = true.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub exclim: Option<bool>,
15    /// Exciter constant related to self-excited field (KE). Typical value = 0,05.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub ke: Option<f64>,
18    /// Fast raise/lower contact setting (KV) (> 0). Typical value = 0,05.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub kv: Option<f64>,
21    /// Exciter saturation function value at the corresponding exciter voltage, EFD1 (SE[EFD1]) (>= 0). Typical value = 0,267.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub seefd1: Option<f64>,
24    /// Exciter saturation function value at the corresponding exciter voltage, EFD2 (SE[EFD2]) (>= 0). Typical value = 0,068.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub seefd2: Option<f64>,
27    /// Exciter time constant, integration rate associated with exciter control (TE) (> 0). Typical value = 0,5.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub te: Option<f64>,
30    /// Rheostat travel time (TRH) (> 0). Typical value = 20.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub trh: Option<f64>,
33    /// Maximum voltage regulator output (VRMAX) (> 0). Typical value = 1.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub vrmax: Option<f64>,
36    /// Minimum voltage regulator output (VRMIN) (<= 0). Typical value = 0.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub vrmin: Option<f64>,
39}
40impl crate::base::CimElement for ExcIEEEDC3A {
41    fn mrid(&self) -> &str { &self.base.base.base.id }
42    fn type_name(&self) -> &'static str { "ExcIEEEDC3A" }
43    fn as_any(&self) -> &dyn std::any::Any { self }
44    fn to_json_value(&self) -> serde_json::Value {
45        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
46    }
47    fn to_block(&self) -> crate::base::RdfBlock {
48        let mut block = self.base.to_block();
49        block.type_name = "ExcIEEEDC3A".to_string();
50        if let Some(v) = self.efd1 {
51            block.fields.insert("ExcIEEEDC3A.efd1".into(), crate::base::FieldValue::Text(v.to_string()));
52        }
53        if let Some(v) = self.efd2 {
54            block.fields.insert("ExcIEEEDC3A.efd2".into(), crate::base::FieldValue::Text(v.to_string()));
55        }
56        if let Some(v) = self.exclim {
57            block.fields.insert("ExcIEEEDC3A.exclim".into(), crate::base::FieldValue::Text(v.to_string()));
58        }
59        if let Some(v) = self.ke {
60            block.fields.insert("ExcIEEEDC3A.ke".into(), crate::base::FieldValue::Text(v.to_string()));
61        }
62        if let Some(v) = self.kv {
63            block.fields.insert("ExcIEEEDC3A.kv".into(), crate::base::FieldValue::Text(v.to_string()));
64        }
65        if let Some(v) = self.seefd1 {
66            block.fields.insert("ExcIEEEDC3A.seefd1".into(), crate::base::FieldValue::Text(v.to_string()));
67        }
68        if let Some(v) = self.seefd2 {
69            block.fields.insert("ExcIEEEDC3A.seefd2".into(), crate::base::FieldValue::Text(v.to_string()));
70        }
71        if let Some(v) = self.te {
72            block.fields.insert("ExcIEEEDC3A.te".into(), crate::base::FieldValue::Text(v.to_string()));
73        }
74        if let Some(v) = self.trh {
75            block.fields.insert("ExcIEEEDC3A.trh".into(), crate::base::FieldValue::Text(v.to_string()));
76        }
77        if let Some(v) = self.vrmax {
78            block.fields.insert("ExcIEEEDC3A.vrmax".into(), crate::base::FieldValue::Text(v.to_string()));
79        }
80        if let Some(v) = self.vrmin {
81            block.fields.insert("ExcIEEEDC3A.vrmin".into(), crate::base::FieldValue::Text(v.to_string()));
82        }
83        block
84    }
85}
86
87impl ExcIEEEDC3A {
88    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
89        let mut obj = Self::default();
90        obj.base.base.base.id.clone_from(&b.mrid);
91        for (key, val) in &b.fields {
92            match key.as_str() {
93                "ExcIEEEDC3A.efd1" => {
94                    match val {
95                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.efd1 = Some(v); } }
96                        crate::base::FieldValue::TextList(svs) => {
97                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.efd1 = Some(v); } }
98                        }
99                        _ => {}
100                    }
101                }
102                "ExcIEEEDC3A.efd2" => {
103                    match val {
104                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.efd2 = Some(v); } }
105                        crate::base::FieldValue::TextList(svs) => {
106                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.efd2 = Some(v); } }
107                        }
108                        _ => {}
109                    }
110                }
111                "ExcIEEEDC3A.exclim" => {
112                    match val {
113                        crate::base::FieldValue::Text(sv) => { obj.exclim = Some(sv.trim() == "true"); }
114                        crate::base::FieldValue::TextList(svs) => {
115                            if let Some(sv) = svs.last() { obj.exclim = Some(sv.trim() == "true"); }
116                        }
117                        _ => {}
118                    }
119                }
120                "ExcIEEEDC3A.ke" => {
121                    match val {
122                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
123                        crate::base::FieldValue::TextList(svs) => {
124                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ke = Some(v); } }
125                        }
126                        _ => {}
127                    }
128                }
129                "ExcIEEEDC3A.kv" => {
130                    match val {
131                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kv = Some(v); } }
132                        crate::base::FieldValue::TextList(svs) => {
133                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kv = Some(v); } }
134                        }
135                        _ => {}
136                    }
137                }
138                "ExcIEEEDC3A.seefd1" => {
139                    match val {
140                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seefd1 = Some(v); } }
141                        crate::base::FieldValue::TextList(svs) => {
142                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seefd1 = Some(v); } }
143                        }
144                        _ => {}
145                    }
146                }
147                "ExcIEEEDC3A.seefd2" => {
148                    match val {
149                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seefd2 = Some(v); } }
150                        crate::base::FieldValue::TextList(svs) => {
151                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seefd2 = Some(v); } }
152                        }
153                        _ => {}
154                    }
155                }
156                "ExcIEEEDC3A.te" => {
157                    match val {
158                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
159                        crate::base::FieldValue::TextList(svs) => {
160                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
161                        }
162                        _ => {}
163                    }
164                }
165                "ExcIEEEDC3A.trh" => {
166                    match val {
167                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.trh = Some(v); } }
168                        crate::base::FieldValue::TextList(svs) => {
169                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.trh = Some(v); } }
170                        }
171                        _ => {}
172                    }
173                }
174                "ExcIEEEDC3A.vrmax" => {
175                    match val {
176                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
177                        crate::base::FieldValue::TextList(svs) => {
178                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
179                        }
180                        _ => {}
181                    }
182                }
183                "ExcIEEEDC3A.vrmin" => {
184                    match val {
185                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
186                        crate::base::FieldValue::TextList(svs) => {
187                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
188                        }
189                        _ => {}
190                    }
191                }
192                "ExcitationSystemDynamics.SynchronousMachineDynamics" => {
193                    if let crate::base::FieldValue::Resource(sv) = val {
194                        obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
195                    }
196                }
197                "DynamicsFunctionBlock.enabled" => {
198                    match val {
199                        crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
200                        crate::base::FieldValue::TextList(svs) => {
201                            if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
202                        }
203                        _ => {}
204                    }
205                }
206                "IdentifiedObject.description" => {
207                    match val {
208                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
209                        crate::base::FieldValue::TextList(svs) => {
210                            if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
211                        }
212                        _ => {}
213                    }
214                }
215                "IdentifiedObject.energyIdentCodeEic" => {
216                    match val {
217                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
218                        crate::base::FieldValue::TextList(svs) => {
219                            if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
220                        }
221                        _ => {}
222                    }
223                }
224                "IdentifiedObject.mRID" => {
225                    match val {
226                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
227                        crate::base::FieldValue::TextList(svs) => {
228                            if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
229                        }
230                        _ => {}
231                    }
232                }
233                "IdentifiedObject.name" => {
234                    match val {
235                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
236                        crate::base::FieldValue::TextList(svs) => {
237                            if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
238                        }
239                        _ => {}
240                    }
241                }
242                "IdentifiedObject.shortName" => {
243                    match val {
244                        crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
245                        crate::base::FieldValue::TextList(svs) => {
246                            if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
247                        }
248                        _ => {}
249                    }
250                }
251                _ => {}
252            }
253        }
254        obj
255    }
256}