cimstructs/
SynchronousMachineTimeConstantReactance.rs1#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct SynchronousMachineTimeConstantReactance {
4 #[serde(flatten)]
5 pub base: super::SynchronousMachineDetailed,
6 #[serde(skip_serializing_if = "Option::is_none")]
8 pub ks: Option<f64>,
9 #[serde(skip_serializing_if = "Option::is_none")]
11 pub model_type: Option<super::base::UriRef>,
12 #[serde(skip_serializing_if = "Option::is_none")]
14 pub rotor_type: Option<super::base::UriRef>,
15 #[serde(skip_serializing_if = "Option::is_none")]
17 pub tc: Option<f64>,
18 #[serde(skip_serializing_if = "Option::is_none")]
20 pub tpdo: Option<f64>,
21 #[serde(skip_serializing_if = "Option::is_none")]
23 pub tppdo: Option<f64>,
24 #[serde(skip_serializing_if = "Option::is_none")]
26 pub tppqo: Option<f64>,
27 #[serde(skip_serializing_if = "Option::is_none")]
29 pub tpqo: Option<f64>,
30 #[serde(skip_serializing_if = "Option::is_none")]
32 pub x_direct_subtrans: Option<f64>,
33 #[serde(skip_serializing_if = "Option::is_none")]
35 pub x_direct_sync: Option<f64>,
36 #[serde(skip_serializing_if = "Option::is_none")]
38 pub x_direct_trans: Option<f64>,
39 #[serde(skip_serializing_if = "Option::is_none")]
41 pub x_quad_subtrans: Option<f64>,
42 #[serde(skip_serializing_if = "Option::is_none")]
44 pub x_quad_sync: Option<f64>,
45 #[serde(skip_serializing_if = "Option::is_none")]
47 pub x_quad_trans: Option<f64>,
48}
49impl crate::base::CimElement for SynchronousMachineTimeConstantReactance {
50 fn mrid(&self) -> &str { &self.base.base.base.base.base.id }
51 fn type_name(&self) -> &'static str { "SynchronousMachineTimeConstantReactance" }
52 fn as_any(&self) -> &dyn std::any::Any { self }
53 fn to_json_value(&self) -> serde_json::Value {
54 serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
55 }
56 fn to_block(&self) -> crate::base::RdfBlock {
57 let mut block = self.base.to_block();
58 block.type_name = "SynchronousMachineTimeConstantReactance".to_string();
59 if let Some(v) = self.ks {
60 block.fields.insert("SynchronousMachineTimeConstantReactance.ks".into(), crate::base::FieldValue::Text(v.to_string()));
61 }
62 if let Some(ref v) = self.model_type {
63 block.fields.insert("SynchronousMachineTimeConstantReactance.modelType".into(), crate::base::FieldValue::Resource(v.uri.clone()));
64 }
65 if let Some(ref v) = self.rotor_type {
66 block.fields.insert("SynchronousMachineTimeConstantReactance.rotorType".into(), crate::base::FieldValue::Resource(v.uri.clone()));
67 }
68 if let Some(v) = self.tc {
69 block.fields.insert("SynchronousMachineTimeConstantReactance.tc".into(), crate::base::FieldValue::Text(v.to_string()));
70 }
71 if let Some(v) = self.tpdo {
72 block.fields.insert("SynchronousMachineTimeConstantReactance.tpdo".into(), crate::base::FieldValue::Text(v.to_string()));
73 }
74 if let Some(v) = self.tppdo {
75 block.fields.insert("SynchronousMachineTimeConstantReactance.tppdo".into(), crate::base::FieldValue::Text(v.to_string()));
76 }
77 if let Some(v) = self.tppqo {
78 block.fields.insert("SynchronousMachineTimeConstantReactance.tppqo".into(), crate::base::FieldValue::Text(v.to_string()));
79 }
80 if let Some(v) = self.tpqo {
81 block.fields.insert("SynchronousMachineTimeConstantReactance.tpqo".into(), crate::base::FieldValue::Text(v.to_string()));
82 }
83 if let Some(v) = self.x_direct_subtrans {
84 block.fields.insert("SynchronousMachineTimeConstantReactance.xDirectSubtrans".into(), crate::base::FieldValue::Text(v.to_string()));
85 }
86 if let Some(v) = self.x_direct_sync {
87 block.fields.insert("SynchronousMachineTimeConstantReactance.xDirectSync".into(), crate::base::FieldValue::Text(v.to_string()));
88 }
89 if let Some(v) = self.x_direct_trans {
90 block.fields.insert("SynchronousMachineTimeConstantReactance.xDirectTrans".into(), crate::base::FieldValue::Text(v.to_string()));
91 }
92 if let Some(v) = self.x_quad_subtrans {
93 block.fields.insert("SynchronousMachineTimeConstantReactance.xQuadSubtrans".into(), crate::base::FieldValue::Text(v.to_string()));
94 }
95 if let Some(v) = self.x_quad_sync {
96 block.fields.insert("SynchronousMachineTimeConstantReactance.xQuadSync".into(), crate::base::FieldValue::Text(v.to_string()));
97 }
98 if let Some(v) = self.x_quad_trans {
99 block.fields.insert("SynchronousMachineTimeConstantReactance.xQuadTrans".into(), crate::base::FieldValue::Text(v.to_string()));
100 }
101 block
102 }
103}
104
105impl SynchronousMachineTimeConstantReactance {
106 pub fn from_block(b: &crate::base::RdfBlock) -> Self {
107 let mut obj = Self::default();
108 obj.base.base.base.base.base.id.clone_from(&b.mrid);
109 for (key, val) in &b.fields {
110 match key.as_str() {
111 "SynchronousMachineTimeConstantReactance.ks" => {
112 match val {
113 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ks = Some(v); } }
114 crate::base::FieldValue::TextList(svs) => {
115 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ks = Some(v); } }
116 }
117 _ => {}
118 }
119 }
120 "SynchronousMachineTimeConstantReactance.modelType" => {
121 if let crate::base::FieldValue::Resource(sv) = val {
122 obj.model_type = Some(crate::base::UriRef { uri: sv.clone() });
123 }
124 }
125 "SynchronousMachineTimeConstantReactance.rotorType" => {
126 if let crate::base::FieldValue::Resource(sv) = val {
127 obj.rotor_type = Some(crate::base::UriRef { uri: sv.clone() });
128 }
129 }
130 "SynchronousMachineTimeConstantReactance.tc" => {
131 match val {
132 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
133 crate::base::FieldValue::TextList(svs) => {
134 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tc = Some(v); } }
135 }
136 _ => {}
137 }
138 }
139 "SynchronousMachineTimeConstantReactance.tpdo" => {
140 match val {
141 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tpdo = Some(v); } }
142 crate::base::FieldValue::TextList(svs) => {
143 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tpdo = Some(v); } }
144 }
145 _ => {}
146 }
147 }
148 "SynchronousMachineTimeConstantReactance.tppdo" => {
149 match val {
150 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tppdo = Some(v); } }
151 crate::base::FieldValue::TextList(svs) => {
152 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tppdo = Some(v); } }
153 }
154 _ => {}
155 }
156 }
157 "SynchronousMachineTimeConstantReactance.tppqo" => {
158 match val {
159 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tppqo = Some(v); } }
160 crate::base::FieldValue::TextList(svs) => {
161 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tppqo = Some(v); } }
162 }
163 _ => {}
164 }
165 }
166 "SynchronousMachineTimeConstantReactance.tpqo" => {
167 match val {
168 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tpqo = Some(v); } }
169 crate::base::FieldValue::TextList(svs) => {
170 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tpqo = Some(v); } }
171 }
172 _ => {}
173 }
174 }
175 "SynchronousMachineTimeConstantReactance.xDirectSubtrans" => {
176 match val {
177 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.x_direct_subtrans = Some(v); } }
178 crate::base::FieldValue::TextList(svs) => {
179 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.x_direct_subtrans = Some(v); } }
180 }
181 _ => {}
182 }
183 }
184 "SynchronousMachineTimeConstantReactance.xDirectSync" => {
185 match val {
186 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.x_direct_sync = Some(v); } }
187 crate::base::FieldValue::TextList(svs) => {
188 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.x_direct_sync = Some(v); } }
189 }
190 _ => {}
191 }
192 }
193 "SynchronousMachineTimeConstantReactance.xDirectTrans" => {
194 match val {
195 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.x_direct_trans = Some(v); } }
196 crate::base::FieldValue::TextList(svs) => {
197 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.x_direct_trans = Some(v); } }
198 }
199 _ => {}
200 }
201 }
202 "SynchronousMachineTimeConstantReactance.xQuadSubtrans" => {
203 match val {
204 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.x_quad_subtrans = Some(v); } }
205 crate::base::FieldValue::TextList(svs) => {
206 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.x_quad_subtrans = Some(v); } }
207 }
208 _ => {}
209 }
210 }
211 "SynchronousMachineTimeConstantReactance.xQuadSync" => {
212 match val {
213 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.x_quad_sync = Some(v); } }
214 crate::base::FieldValue::TextList(svs) => {
215 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.x_quad_sync = Some(v); } }
216 }
217 _ => {}
218 }
219 }
220 "SynchronousMachineTimeConstantReactance.xQuadTrans" => {
221 match val {
222 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.x_quad_trans = Some(v); } }
223 crate::base::FieldValue::TextList(svs) => {
224 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.x_quad_trans = Some(v); } }
225 }
226 _ => {}
227 }
228 }
229 "SynchronousMachineDetailed.efdBaseRatio" => {
230 match val {
231 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.base.efd_base_ratio = Some(v); } }
232 crate::base::FieldValue::TextList(svs) => {
233 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.base.efd_base_ratio = Some(v); } }
234 }
235 _ => {}
236 }
237 }
238 "SynchronousMachineDetailed.ifdBaseType" => {
239 if let crate::base::FieldValue::Resource(sv) = val {
240 obj.base.ifd_base_type = Some(crate::base::UriRef { uri: sv.clone() });
241 }
242 }
243 "SynchronousMachineDetailed.saturationFactor120QAxis" => {
244 match val {
245 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.base.saturation_factor120q_axis = Some(v); } }
246 crate::base::FieldValue::TextList(svs) => {
247 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.base.saturation_factor120q_axis = Some(v); } }
248 }
249 _ => {}
250 }
251 }
252 "SynchronousMachineDetailed.saturationFactorQAxis" => {
253 match val {
254 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.base.saturation_factor_q_axis = Some(v); } }
255 crate::base::FieldValue::TextList(svs) => {
256 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.base.saturation_factor_q_axis = Some(v); } }
257 }
258 _ => {}
259 }
260 }
261 "SynchronousMachineDynamics.SynchronousMachine" => {
262 if let crate::base::FieldValue::Resource(sv) = val {
263 obj.base.base.synchronous_machine = Some(crate::base::MridRef { mrid: sv.clone() });
264 }
265 }
266 "RotatingMachineDynamics.damping" => {
267 match val {
268 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.base.base.base.damping = Some(v); } }
269 crate::base::FieldValue::TextList(svs) => {
270 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.base.base.base.damping = Some(v); } }
271 }
272 _ => {}
273 }
274 }
275 "RotatingMachineDynamics.inertia" => {
276 match val {
277 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.base.base.base.inertia = Some(v); } }
278 crate::base::FieldValue::TextList(svs) => {
279 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.base.base.base.inertia = Some(v); } }
280 }
281 _ => {}
282 }
283 }
284 "RotatingMachineDynamics.saturationFactor" => {
285 match val {
286 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.base.base.base.saturation_factor = Some(v); } }
287 crate::base::FieldValue::TextList(svs) => {
288 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.base.base.base.saturation_factor = Some(v); } }
289 }
290 _ => {}
291 }
292 }
293 "RotatingMachineDynamics.saturationFactor120" => {
294 match val {
295 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.base.base.base.saturation_factor120 = Some(v); } }
296 crate::base::FieldValue::TextList(svs) => {
297 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.base.base.base.saturation_factor120 = Some(v); } }
298 }
299 _ => {}
300 }
301 }
302 "RotatingMachineDynamics.statorLeakageReactance" => {
303 match val {
304 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.base.base.base.stator_leakage_reactance = Some(v); } }
305 crate::base::FieldValue::TextList(svs) => {
306 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.base.base.base.stator_leakage_reactance = Some(v); } }
307 }
308 _ => {}
309 }
310 }
311 "RotatingMachineDynamics.statorResistance" => {
312 match val {
313 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.base.base.base.stator_resistance = Some(v); } }
314 crate::base::FieldValue::TextList(svs) => {
315 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.base.base.base.stator_resistance = Some(v); } }
316 }
317 _ => {}
318 }
319 }
320 "DynamicsFunctionBlock.enabled" => {
321 match val {
322 crate::base::FieldValue::Text(sv) => { obj.base.base.base.base.enabled = Some(sv.trim() == "true"); }
323 crate::base::FieldValue::TextList(svs) => {
324 if let Some(sv) = svs.last() { obj.base.base.base.base.enabled = Some(sv.trim() == "true"); }
325 }
326 _ => {}
327 }
328 }
329 "IdentifiedObject.description" => {
330 match val {
331 crate::base::FieldValue::Text(sv) => { obj.base.base.base.base.base.description = sv.clone(); }
332 crate::base::FieldValue::TextList(svs) => {
333 if let Some(sv) = svs.last() { obj.base.base.base.base.base.description = sv.clone(); }
334 }
335 _ => {}
336 }
337 }
338 "IdentifiedObject.energyIdentCodeEic" => {
339 match val {
340 crate::base::FieldValue::Text(sv) => { obj.base.base.base.base.base.energy_ident_code_eic = sv.clone(); }
341 crate::base::FieldValue::TextList(svs) => {
342 if let Some(sv) = svs.last() { obj.base.base.base.base.base.energy_ident_code_eic = sv.clone(); }
343 }
344 _ => {}
345 }
346 }
347 "IdentifiedObject.mRID" => {
348 match val {
349 crate::base::FieldValue::Text(sv) => { obj.base.base.base.base.base.m_rid = sv.clone(); }
350 crate::base::FieldValue::TextList(svs) => {
351 if let Some(sv) = svs.last() { obj.base.base.base.base.base.m_rid = sv.clone(); }
352 }
353 _ => {}
354 }
355 }
356 "IdentifiedObject.name" => {
357 match val {
358 crate::base::FieldValue::Text(sv) => { obj.base.base.base.base.base.name = sv.clone(); }
359 crate::base::FieldValue::TextList(svs) => {
360 if let Some(sv) = svs.last() { obj.base.base.base.base.base.name = sv.clone(); }
361 }
362 _ => {}
363 }
364 }
365 "IdentifiedObject.shortName" => {
366 match val {
367 crate::base::FieldValue::Text(sv) => { obj.base.base.base.base.base.short_name = sv.clone(); }
368 crate::base::FieldValue::TextList(svs) => {
369 if let Some(sv) = svs.last() { obj.base.base.base.base.base.short_name = sv.clone(); }
370 }
371 _ => {}
372 }
373 }
374 _ => {}
375 }
376 }
377 obj
378 }
379}