Skip to main content

cimstructs/
WindContCurrLimIEC.rs

1/// Current limitation model. The current limitation model combines the physical limits and the control limits. Reference: IEC 61400-27-1:2015, 5.6.5.8.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct WindContCurrLimIEC {
4    #[serde(flatten)]
5    pub base: super::IdentifiedObject,
6    /// Maximum continuous current at the wind turbine terminals (imax). It is a type-dependent parameter.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub imax: Option<f64>,
9    /// Maximum current during voltage dip at the wind turbine terminals (imaxdip). It is a project-dependent parameter.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub imaxdip: Option<f64>,
12    /// Partial derivative of reactive current limit (Kpqu) versus voltage. It is a type-dependent parameter.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub kpqu: Option<f64>,
15    /// Limitation of type 3 stator current (MDFSLim). MDFSLim = 1 for wind turbines type 4. It is a type-dependent parameter. false= total current limitation (0 in the IEC model) true=stator current limitation (1 in the IEC model).
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub mdfslim: Option<bool>,
18    /// Prioritisation of Q control during UVRT (Mqpri). It is a project-dependent parameter. true = reactive power priority (1 in the IEC model) false = active power priority (0 in the IEC model).
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub mqpri: Option<bool>,
21    /// Voltage measurement filter time constant (Tufiltcl) (>= 0). It is a type-dependent parameter.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub tufiltcl: Option<f64>,
24    /// Wind turbine voltage in the operation point where zero reactive current can be delivered (upqumax). It is a type-dependent parameter.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub upqumax: Option<f64>,
27}
28impl crate::base::CimElement for WindContCurrLimIEC {
29    fn mrid(&self) -> &str { &self.base.id }
30    fn type_name(&self) -> &'static str { "WindContCurrLimIEC" }
31    fn as_any(&self) -> &dyn std::any::Any { self }
32    fn to_json_value(&self) -> serde_json::Value {
33        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
34    }
35    fn to_block(&self) -> crate::base::RdfBlock {
36        let mut block = self.base.to_block();
37        block.type_name = "WindContCurrLimIEC".to_string();
38        if let Some(v) = self.imax {
39            block.fields.insert("WindContCurrLimIEC.imax".into(), crate::base::FieldValue::Text(v.to_string()));
40        }
41        if let Some(v) = self.imaxdip {
42            block.fields.insert("WindContCurrLimIEC.imaxdip".into(), crate::base::FieldValue::Text(v.to_string()));
43        }
44        if let Some(v) = self.kpqu {
45            block.fields.insert("WindContCurrLimIEC.kpqu".into(), crate::base::FieldValue::Text(v.to_string()));
46        }
47        if let Some(v) = self.mdfslim {
48            block.fields.insert("WindContCurrLimIEC.mdfslim".into(), crate::base::FieldValue::Text(v.to_string()));
49        }
50        if let Some(v) = self.mqpri {
51            block.fields.insert("WindContCurrLimIEC.mqpri".into(), crate::base::FieldValue::Text(v.to_string()));
52        }
53        if let Some(v) = self.tufiltcl {
54            block.fields.insert("WindContCurrLimIEC.tufiltcl".into(), crate::base::FieldValue::Text(v.to_string()));
55        }
56        if let Some(v) = self.upqumax {
57            block.fields.insert("WindContCurrLimIEC.upqumax".into(), crate::base::FieldValue::Text(v.to_string()));
58        }
59        block
60    }
61}
62
63impl WindContCurrLimIEC {
64    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
65        let mut obj = Self::default();
66        obj.base.id.clone_from(&b.mrid);
67        for (key, val) in &b.fields {
68            match key.as_str() {
69                "WindContCurrLimIEC.imax" => {
70                    match val {
71                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.imax = Some(v); } }
72                        crate::base::FieldValue::TextList(svs) => {
73                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.imax = Some(v); } }
74                        }
75                        _ => {}
76                    }
77                }
78                "WindContCurrLimIEC.imaxdip" => {
79                    match val {
80                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.imaxdip = Some(v); } }
81                        crate::base::FieldValue::TextList(svs) => {
82                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.imaxdip = Some(v); } }
83                        }
84                        _ => {}
85                    }
86                }
87                "WindContCurrLimIEC.kpqu" => {
88                    match val {
89                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kpqu = Some(v); } }
90                        crate::base::FieldValue::TextList(svs) => {
91                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kpqu = Some(v); } }
92                        }
93                        _ => {}
94                    }
95                }
96                "WindContCurrLimIEC.mdfslim" => {
97                    match val {
98                        crate::base::FieldValue::Text(sv) => { obj.mdfslim = Some(sv.trim() == "true"); }
99                        crate::base::FieldValue::TextList(svs) => {
100                            if let Some(sv) = svs.last() { obj.mdfslim = Some(sv.trim() == "true"); }
101                        }
102                        _ => {}
103                    }
104                }
105                "WindContCurrLimIEC.mqpri" => {
106                    match val {
107                        crate::base::FieldValue::Text(sv) => { obj.mqpri = Some(sv.trim() == "true"); }
108                        crate::base::FieldValue::TextList(svs) => {
109                            if let Some(sv) = svs.last() { obj.mqpri = Some(sv.trim() == "true"); }
110                        }
111                        _ => {}
112                    }
113                }
114                "WindContCurrLimIEC.tufiltcl" => {
115                    match val {
116                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tufiltcl = Some(v); } }
117                        crate::base::FieldValue::TextList(svs) => {
118                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tufiltcl = Some(v); } }
119                        }
120                        _ => {}
121                    }
122                }
123                "WindContCurrLimIEC.upqumax" => {
124                    match val {
125                        crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.upqumax = Some(v); } }
126                        crate::base::FieldValue::TextList(svs) => {
127                            if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.upqumax = Some(v); } }
128                        }
129                        _ => {}
130                    }
131                }
132                "IdentifiedObject.description" => {
133                    match val {
134                        crate::base::FieldValue::Text(sv) => { obj.base.description = sv.clone(); }
135                        crate::base::FieldValue::TextList(svs) => {
136                            if let Some(sv) = svs.last() { obj.base.description = sv.clone(); }
137                        }
138                        _ => {}
139                    }
140                }
141                "IdentifiedObject.energyIdentCodeEic" => {
142                    match val {
143                        crate::base::FieldValue::Text(sv) => { obj.base.energy_ident_code_eic = sv.clone(); }
144                        crate::base::FieldValue::TextList(svs) => {
145                            if let Some(sv) = svs.last() { obj.base.energy_ident_code_eic = sv.clone(); }
146                        }
147                        _ => {}
148                    }
149                }
150                "IdentifiedObject.mRID" => {
151                    match val {
152                        crate::base::FieldValue::Text(sv) => { obj.base.m_rid = sv.clone(); }
153                        crate::base::FieldValue::TextList(svs) => {
154                            if let Some(sv) = svs.last() { obj.base.m_rid = sv.clone(); }
155                        }
156                        _ => {}
157                    }
158                }
159                "IdentifiedObject.name" => {
160                    match val {
161                        crate::base::FieldValue::Text(sv) => { obj.base.name = sv.clone(); }
162                        crate::base::FieldValue::TextList(svs) => {
163                            if let Some(sv) = svs.last() { obj.base.name = sv.clone(); }
164                        }
165                        _ => {}
166                    }
167                }
168                "IdentifiedObject.shortName" => {
169                    match val {
170                        crate::base::FieldValue::Text(sv) => { obj.base.short_name = sv.clone(); }
171                        crate::base::FieldValue::TextList(svs) => {
172                            if let Some(sv) = svs.last() { obj.base.short_name = sv.clone(); }
173                        }
174                        _ => {}
175                    }
176                }
177                _ => {}
178            }
179        }
180        obj
181    }
182}