Skip to main content

cimstructs/
WindContQIEC.rs

1/// Q control model. Reference: IEC 61400-27-1:2015, 5.6.5.7.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct WindContQIEC {
4    #[serde(flatten)]
5    pub base: super::IdentifiedObject,
6    /// Maximum reactive current injection during dip (iqh1). It is a type-dependent parameter.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub iqh1: Option<f64>,
9    /// Maximum reactive current injection (iqmax) (> WindContQIEC.iqmin). It is a type-dependent parameter.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub iqmax: Option<f64>,
12    /// Minimum reactive current injection (iqmin) (< WindContQIEC.iqmax). It is a type-dependent parameter.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub iqmin: Option<f64>,
15    /// Post fault reactive current injection (iqpost). It is a project-dependent parameter.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub iqpost: Option<f64>,
18    /// Reactive power PI controller integration gain (KI,q). It is a type-dependent parameter.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub kiq: Option<f64>,
21    /// Voltage PI controller integration gain (KI,u). It is a type-dependent parameter.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub kiu: Option<f64>,
24    /// Reactive power PI controller proportional gain (KP,q). It is a type-dependent parameter.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub kpq: Option<f64>,
27    /// Voltage PI controller proportional gain (KP,u). It is a type-dependent parameter.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub kpu: Option<f64>,
30    /// Voltage scaling factor for UVRT current (Kqv). It is a project-dependent parameter.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub kqv: Option<f64>,
33    /// Resistive component of voltage drop impedance (rdroop) (>= 0). It is a project-dependent parameter.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub rdroop: Option<f64>,
36    /// Power measurement filter time constant (Tpfiltq) (>= 0). It is a type-dependent parameter.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub tpfiltq: Option<f64>,
39    /// Length of time period where post fault reactive power is injected (Tpost) (>= 0). It is a project-dependent parameter.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub tpost: Option<f64>,
42    /// Time constant in reactive power order lag (Tqord) (>= 0). It is a type-dependent parameter.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub tqord: Option<f64>,
45    /// Voltage measurement filter time constant (Tufiltq) (>= 0). It is a type-dependent parameter.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub tufiltq: Option<f64>,
48    /// Voltage deadband lower limit (udb1). It is a type-dependent parameter.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub udb1: Option<f64>,
51    /// Voltage deadband upper limit (udb2). It is a type-dependent parameter.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub udb2: Option<f64>,
54    /// Maximum voltage in voltage PI controller integral term (umax) (> WindContQIEC.umin). It is a type-dependent parameter.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub umax: Option<f64>,
57    /// Minimum voltage in voltage PI controller integral term (umin) (< WindContQIEC.umax). It is a type-dependent parameter.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub umin: Option<f64>,
60    /// Voltage threshold for UVRT detection in Q control (uqdip). It is a type-dependent parameter.
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub uqdip: Option<f64>,
63    /// User-defined bias in voltage reference (uref0). It is a case-dependent parameter.
64    #[serde(skip_serializing_if = "Option::is_none")]
65    pub uref0: Option<f64>,
66    /// Types of general wind turbine Q control modes (MqG). It is a project-dependent parameter.
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub wind_qcontrol_modes_type: Option<super::base::UriRef>,
69    /// Types of UVRT Q control modes (MqUVRT). It is a project-dependent parameter.
70    #[serde(skip_serializing_if = "Option::is_none")]
71    pub wind_uvrt_qcontrol_modes_type: Option<super::base::UriRef>,
72    /// Inductive component of voltage drop impedance (xdroop) (>= 0). It is a project-dependent parameter.
73    #[serde(skip_serializing_if = "Option::is_none")]
74    pub xdroop: Option<f64>,
75}
76impl crate::base::CimElement for WindContQIEC {
77    fn mrid(&self) -> &str { &self.base.id }
78    fn type_name(&self) -> &'static str { "WindContQIEC" }
79    fn as_any(&self) -> &dyn std::any::Any { self }
80    fn to_json_value(&self) -> serde_json::Value {
81        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
82    }
83    fn to_block(&self) -> crate::base::RdfBlock {
84        let mut block = self.base.to_block();
85        block.type_name = "WindContQIEC".to_string();
86        if let Some(v) = self.iqh1 {
87            block.fields.insert("WindContQIEC.iqh1".into(), crate::base::FieldValue::Text(v.to_string()));
88        }
89        if let Some(v) = self.iqmax {
90            block.fields.insert("WindContQIEC.iqmax".into(), crate::base::FieldValue::Text(v.to_string()));
91        }
92        if let Some(v) = self.iqmin {
93            block.fields.insert("WindContQIEC.iqmin".into(), crate::base::FieldValue::Text(v.to_string()));
94        }
95        if let Some(v) = self.iqpost {
96            block.fields.insert("WindContQIEC.iqpost".into(), crate::base::FieldValue::Text(v.to_string()));
97        }
98        if let Some(v) = self.kiq {
99            block.fields.insert("WindContQIEC.kiq".into(), crate::base::FieldValue::Text(v.to_string()));
100        }
101        if let Some(v) = self.kiu {
102            block.fields.insert("WindContQIEC.kiu".into(), crate::base::FieldValue::Text(v.to_string()));
103        }
104        if let Some(v) = self.kpq {
105            block.fields.insert("WindContQIEC.kpq".into(), crate::base::FieldValue::Text(v.to_string()));
106        }
107        if let Some(v) = self.kpu {
108            block.fields.insert("WindContQIEC.kpu".into(), crate::base::FieldValue::Text(v.to_string()));
109        }
110        if let Some(v) = self.kqv {
111            block.fields.insert("WindContQIEC.kqv".into(), crate::base::FieldValue::Text(v.to_string()));
112        }
113        if let Some(v) = self.rdroop {
114            block.fields.insert("WindContQIEC.rdroop".into(), crate::base::FieldValue::Text(v.to_string()));
115        }
116        if let Some(v) = self.tpfiltq {
117            block.fields.insert("WindContQIEC.tpfiltq".into(), crate::base::FieldValue::Text(v.to_string()));
118        }
119        if let Some(v) = self.tpost {
120            block.fields.insert("WindContQIEC.tpost".into(), crate::base::FieldValue::Text(v.to_string()));
121        }
122        if let Some(v) = self.tqord {
123            block.fields.insert("WindContQIEC.tqord".into(), crate::base::FieldValue::Text(v.to_string()));
124        }
125        if let Some(v) = self.tufiltq {
126            block.fields.insert("WindContQIEC.tufiltq".into(), crate::base::FieldValue::Text(v.to_string()));
127        }
128        if let Some(v) = self.udb1 {
129            block.fields.insert("WindContQIEC.udb1".into(), crate::base::FieldValue::Text(v.to_string()));
130        }
131        if let Some(v) = self.udb2 {
132            block.fields.insert("WindContQIEC.udb2".into(), crate::base::FieldValue::Text(v.to_string()));
133        }
134        if let Some(v) = self.umax {
135            block.fields.insert("WindContQIEC.umax".into(), crate::base::FieldValue::Text(v.to_string()));
136        }
137        if let Some(v) = self.umin {
138            block.fields.insert("WindContQIEC.umin".into(), crate::base::FieldValue::Text(v.to_string()));
139        }
140        if let Some(v) = self.uqdip {
141            block.fields.insert("WindContQIEC.uqdip".into(), crate::base::FieldValue::Text(v.to_string()));
142        }
143        if let Some(v) = self.uref0 {
144            block.fields.insert("WindContQIEC.uref0".into(), crate::base::FieldValue::Text(v.to_string()));
145        }
146        if let Some(ref v) = self.wind_qcontrol_modes_type {
147            block.fields.insert("WindContQIEC.windQcontrolModesType".into(), crate::base::FieldValue::Resource(v.uri.clone()));
148        }
149        if let Some(ref v) = self.wind_uvrt_qcontrol_modes_type {
150            block.fields.insert("WindContQIEC.windUVRTQcontrolModesType".into(), crate::base::FieldValue::Resource(v.uri.clone()));
151        }
152        if let Some(v) = self.xdroop {
153            block.fields.insert("WindContQIEC.xdroop".into(), crate::base::FieldValue::Text(v.to_string()));
154        }
155        block
156    }
157}
158
159impl WindContQIEC {
160    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
161        let mut obj = Self::default();
162        obj.base.id.clone_from(&b.mrid);
163        for (key, val) in &b.fields {
164            match key.as_str() {
165                "WindContQIEC.iqh1" => {
166                    match val {
167                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.iqh1 = Some(v); } }
168                        crate::base::FieldValue::TextList(svs) => {
169                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.iqh1 = Some(v); } }
170                        }
171                        _ => {}
172                    }
173                }
174                "WindContQIEC.iqmax" => {
175                    match val {
176                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.iqmax = Some(v); } }
177                        crate::base::FieldValue::TextList(svs) => {
178                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.iqmax = Some(v); } }
179                        }
180                        _ => {}
181                    }
182                }
183                "WindContQIEC.iqmin" => {
184                    match val {
185                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.iqmin = Some(v); } }
186                        crate::base::FieldValue::TextList(svs) => {
187                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.iqmin = Some(v); } }
188                        }
189                        _ => {}
190                    }
191                }
192                "WindContQIEC.iqpost" => {
193                    match val {
194                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.iqpost = Some(v); } }
195                        crate::base::FieldValue::TextList(svs) => {
196                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.iqpost = Some(v); } }
197                        }
198                        _ => {}
199                    }
200                }
201                "WindContQIEC.kiq" => {
202                    match val {
203                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kiq = Some(v); } }
204                        crate::base::FieldValue::TextList(svs) => {
205                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kiq = Some(v); } }
206                        }
207                        _ => {}
208                    }
209                }
210                "WindContQIEC.kiu" => {
211                    match val {
212                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kiu = Some(v); } }
213                        crate::base::FieldValue::TextList(svs) => {
214                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kiu = Some(v); } }
215                        }
216                        _ => {}
217                    }
218                }
219                "WindContQIEC.kpq" => {
220                    match val {
221                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kpq = Some(v); } }
222                        crate::base::FieldValue::TextList(svs) => {
223                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kpq = Some(v); } }
224                        }
225                        _ => {}
226                    }
227                }
228                "WindContQIEC.kpu" => {
229                    match val {
230                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kpu = Some(v); } }
231                        crate::base::FieldValue::TextList(svs) => {
232                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kpu = Some(v); } }
233                        }
234                        _ => {}
235                    }
236                }
237                "WindContQIEC.kqv" => {
238                    match val {
239                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kqv = Some(v); } }
240                        crate::base::FieldValue::TextList(svs) => {
241                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kqv = Some(v); } }
242                        }
243                        _ => {}
244                    }
245                }
246                "WindContQIEC.rdroop" => {
247                    match val {
248                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.rdroop = Some(v); } }
249                        crate::base::FieldValue::TextList(svs) => {
250                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.rdroop = Some(v); } }
251                        }
252                        _ => {}
253                    }
254                }
255                "WindContQIEC.tpfiltq" => {
256                    match val {
257                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tpfiltq = Some(v); } }
258                        crate::base::FieldValue::TextList(svs) => {
259                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tpfiltq = Some(v); } }
260                        }
261                        _ => {}
262                    }
263                }
264                "WindContQIEC.tpost" => {
265                    match val {
266                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tpost = Some(v); } }
267                        crate::base::FieldValue::TextList(svs) => {
268                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tpost = Some(v); } }
269                        }
270                        _ => {}
271                    }
272                }
273                "WindContQIEC.tqord" => {
274                    match val {
275                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tqord = Some(v); } }
276                        crate::base::FieldValue::TextList(svs) => {
277                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tqord = Some(v); } }
278                        }
279                        _ => {}
280                    }
281                }
282                "WindContQIEC.tufiltq" => {
283                    match val {
284                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tufiltq = Some(v); } }
285                        crate::base::FieldValue::TextList(svs) => {
286                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tufiltq = Some(v); } }
287                        }
288                        _ => {}
289                    }
290                }
291                "WindContQIEC.udb1" => {
292                    match val {
293                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.udb1 = Some(v); } }
294                        crate::base::FieldValue::TextList(svs) => {
295                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.udb1 = Some(v); } }
296                        }
297                        _ => {}
298                    }
299                }
300                "WindContQIEC.udb2" => {
301                    match val {
302                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.udb2 = Some(v); } }
303                        crate::base::FieldValue::TextList(svs) => {
304                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.udb2 = Some(v); } }
305                        }
306                        _ => {}
307                    }
308                }
309                "WindContQIEC.umax" => {
310                    match val {
311                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.umax = Some(v); } }
312                        crate::base::FieldValue::TextList(svs) => {
313                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.umax = Some(v); } }
314                        }
315                        _ => {}
316                    }
317                }
318                "WindContQIEC.umin" => {
319                    match val {
320                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.umin = Some(v); } }
321                        crate::base::FieldValue::TextList(svs) => {
322                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.umin = Some(v); } }
323                        }
324                        _ => {}
325                    }
326                }
327                "WindContQIEC.uqdip" => {
328                    match val {
329                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.uqdip = Some(v); } }
330                        crate::base::FieldValue::TextList(svs) => {
331                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.uqdip = Some(v); } }
332                        }
333                        _ => {}
334                    }
335                }
336                "WindContQIEC.uref0" => {
337                    match val {
338                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.uref0 = Some(v); } }
339                        crate::base::FieldValue::TextList(svs) => {
340                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.uref0 = Some(v); } }
341                        }
342                        _ => {}
343                    }
344                }
345                "WindContQIEC.windQcontrolModesType" => {
346                    if let crate::base::FieldValue::Resource(sv) = val {
347                        obj.wind_qcontrol_modes_type = Some(crate::base::UriRef { uri: sv.clone() });
348                    }
349                }
350                "WindContQIEC.windUVRTQcontrolModesType" => {
351                    if let crate::base::FieldValue::Resource(sv) = val {
352                        obj.wind_uvrt_qcontrol_modes_type = Some(crate::base::UriRef { uri: sv.clone() });
353                    }
354                }
355                "WindContQIEC.xdroop" => {
356                    match val {
357                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.xdroop = Some(v); } }
358                        crate::base::FieldValue::TextList(svs) => {
359                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.xdroop = Some(v); } }
360                        }
361                        _ => {}
362                    }
363                }
364                "IdentifiedObject.description" => {
365                    match val {
366                        crate::base::FieldValue::Text(sv) => { obj.base.description = sv.clone(); }
367                        crate::base::FieldValue::TextList(svs) => {
368                            if let Some(sv) = svs.last() { obj.base.description = sv.clone(); }
369                        }
370                        _ => {}
371                    }
372                }
373                "IdentifiedObject.energyIdentCodeEic" => {
374                    match val {
375                        crate::base::FieldValue::Text(sv) => { obj.base.energy_ident_code_eic = sv.clone(); }
376                        crate::base::FieldValue::TextList(svs) => {
377                            if let Some(sv) = svs.last() { obj.base.energy_ident_code_eic = sv.clone(); }
378                        }
379                        _ => {}
380                    }
381                }
382                "IdentifiedObject.mRID" => {
383                    match val {
384                        crate::base::FieldValue::Text(sv) => { obj.base.m_rid = sv.clone(); }
385                        crate::base::FieldValue::TextList(svs) => {
386                            if let Some(sv) = svs.last() { obj.base.m_rid = sv.clone(); }
387                        }
388                        _ => {}
389                    }
390                }
391                "IdentifiedObject.name" => {
392                    match val {
393                        crate::base::FieldValue::Text(sv) => { obj.base.name = sv.clone(); }
394                        crate::base::FieldValue::TextList(svs) => {
395                            if let Some(sv) = svs.last() { obj.base.name = sv.clone(); }
396                        }
397                        _ => {}
398                    }
399                }
400                "IdentifiedObject.shortName" => {
401                    match val {
402                        crate::base::FieldValue::Text(sv) => { obj.base.short_name = sv.clone(); }
403                        crate::base::FieldValue::TextList(svs) => {
404                            if let Some(sv) = svs.last() { obj.base.short_name = sv.clone(); }
405                        }
406                        _ => {}
407                    }
408                }
409                _ => {}
410            }
411        }
412        obj
413    }
414}