cimstructs/
WindTurbineType3or4IEC.rs1#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct WindTurbineType3or4IEC {
4 #[serde(flatten)]
5 pub base: super::WindTurbineType3or4Dynamics,
6 #[serde(skip_serializing_if = "Option::is_none")]
8 pub w_ind_cont_qiec: Option<super::base::MridRef>,
9 #[serde(skip_serializing_if = "Option::is_none")]
11 pub wind_cont_curr_lim_iec: Option<super::base::MridRef>,
12 #[serde(skip_serializing_if = "Option::is_none")]
14 pub wind_cont_q_lim_iec: Option<super::base::MridRef>,
15 #[serde(skip_serializing_if = "Option::is_none")]
17 pub wind_cont_qpqu_lim_iec: Option<super::base::MridRef>,
18 #[serde(skip_serializing_if = "Option::is_none")]
20 pub wind_protection_iec: Option<super::base::MridRef>,
21 #[serde(skip_serializing_if = "Option::is_none")]
23 pub wind_ref_frame_rot_iec: Option<super::base::MridRef>,
24}
25impl crate::base::CimElement for WindTurbineType3or4IEC {
26 fn mrid(&self) -> &str { &self.base.base.base.id }
27 fn type_name(&self) -> &'static str { "WindTurbineType3or4IEC" }
28 fn as_any(&self) -> &dyn std::any::Any { self }
29 fn to_json_value(&self) -> serde_json::Value {
30 serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
31 }
32 fn to_block(&self) -> crate::base::RdfBlock {
33 let mut block = self.base.to_block();
34 block.type_name = "WindTurbineType3or4IEC".to_string();
35 if let Some(ref v) = self.w_ind_cont_qiec {
36 block.fields.insert("WindTurbineType3or4IEC.WIndContQIEC".into(), crate::base::FieldValue::Resource(v.mrid.clone()));
37 }
38 if let Some(ref v) = self.wind_cont_curr_lim_iec {
39 block.fields.insert("WindTurbineType3or4IEC.WindContCurrLimIEC".into(), crate::base::FieldValue::Resource(v.mrid.clone()));
40 }
41 if let Some(ref v) = self.wind_cont_q_lim_iec {
42 block.fields.insert("WindTurbineType3or4IEC.WindContQLimIEC".into(), crate::base::FieldValue::Resource(v.mrid.clone()));
43 }
44 if let Some(ref v) = self.wind_cont_qpqu_lim_iec {
45 block.fields.insert("WindTurbineType3or4IEC.WindContQPQULimIEC".into(), crate::base::FieldValue::Resource(v.mrid.clone()));
46 }
47 if let Some(ref v) = self.wind_protection_iec {
48 block.fields.insert("WindTurbineType3or4IEC.WindProtectionIEC".into(), crate::base::FieldValue::Resource(v.mrid.clone()));
49 }
50 if let Some(ref v) = self.wind_ref_frame_rot_iec {
51 block.fields.insert("WindTurbineType3or4IEC.WindRefFrameRotIEC".into(), crate::base::FieldValue::Resource(v.mrid.clone()));
52 }
53 block
54 }
55}
56
57impl WindTurbineType3or4IEC {
58 pub fn from_block(b: &crate::base::RdfBlock) -> Self {
59 let mut obj = Self::default();
60 obj.base.base.base.id.clone_from(&b.mrid);
61 for (key, val) in &b.fields {
62 match key.as_str() {
63 "WindTurbineType3or4IEC.WIndContQIEC" => {
64 if let crate::base::FieldValue::Resource(sv) = val {
65 obj.w_ind_cont_qiec = Some(crate::base::MridRef { mrid: sv.clone() });
66 }
67 }
68 "WindTurbineType3or4IEC.WindContCurrLimIEC" => {
69 if let crate::base::FieldValue::Resource(sv) = val {
70 obj.wind_cont_curr_lim_iec = Some(crate::base::MridRef { mrid: sv.clone() });
71 }
72 }
73 "WindTurbineType3or4IEC.WindContQLimIEC" => {
74 if let crate::base::FieldValue::Resource(sv) = val {
75 obj.wind_cont_q_lim_iec = Some(crate::base::MridRef { mrid: sv.clone() });
76 }
77 }
78 "WindTurbineType3or4IEC.WindContQPQULimIEC" => {
79 if let crate::base::FieldValue::Resource(sv) = val {
80 obj.wind_cont_qpqu_lim_iec = Some(crate::base::MridRef { mrid: sv.clone() });
81 }
82 }
83 "WindTurbineType3or4IEC.WindProtectionIEC" => {
84 if let crate::base::FieldValue::Resource(sv) = val {
85 obj.wind_protection_iec = Some(crate::base::MridRef { mrid: sv.clone() });
86 }
87 }
88 "WindTurbineType3or4IEC.WindRefFrameRotIEC" => {
89 if let crate::base::FieldValue::Resource(sv) = val {
90 obj.wind_ref_frame_rot_iec = Some(crate::base::MridRef { mrid: sv.clone() });
91 }
92 }
93 "WindTurbineType3or4Dynamics.PowerElectronicsConnection" => {
94 if let crate::base::FieldValue::Resource(sv) = val {
95 obj.base.power_electronics_connection = Some(crate::base::MridRef { mrid: sv.clone() });
96 }
97 }
98 "WindTurbineType3or4Dynamics.RemoteInputSignal" => {
99 if let crate::base::FieldValue::Resource(sv) = val {
100 obj.base.remote_input_signal = Some(crate::base::MridRef { mrid: sv.clone() });
101 }
102 }
103 "WindTurbineType3or4Dynamics.WindPlantDynamics" => {
104 if let crate::base::FieldValue::Resource(sv) = val {
105 obj.base.wind_plant_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
106 }
107 }
108 "DynamicsFunctionBlock.enabled" => {
109 match val {
110 crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
111 crate::base::FieldValue::TextList(svs) => {
112 if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
113 }
114 _ => {}
115 }
116 }
117 "IdentifiedObject.description" => {
118 match val {
119 crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
120 crate::base::FieldValue::TextList(svs) => {
121 if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
122 }
123 _ => {}
124 }
125 }
126 "IdentifiedObject.energyIdentCodeEic" => {
127 match val {
128 crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
129 crate::base::FieldValue::TextList(svs) => {
130 if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
131 }
132 _ => {}
133 }
134 }
135 "IdentifiedObject.mRID" => {
136 match val {
137 crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
138 crate::base::FieldValue::TextList(svs) => {
139 if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
140 }
141 _ => {}
142 }
143 }
144 "IdentifiedObject.name" => {
145 match val {
146 crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
147 crate::base::FieldValue::TextList(svs) => {
148 if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
149 }
150 _ => {}
151 }
152 }
153 "IdentifiedObject.shortName" => {
154 match val {
155 crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
156 crate::base::FieldValue::TextList(svs) => {
157 if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
158 }
159 _ => {}
160 }
161 }
162 _ => {}
163 }
164 }
165 obj
166 }
167}