1#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcELIN2 {
4 #[serde(flatten)]
5 pub base: super::ExcitationSystemDynamics,
6 #[serde(skip_serializing_if = "Option::is_none")]
8 pub efdbas: Option<f64>,
9 #[serde(skip_serializing_if = "Option::is_none")]
11 pub iefmax: Option<f64>,
12 #[serde(skip_serializing_if = "Option::is_none")]
14 pub iefmax2: Option<f64>,
15 #[serde(skip_serializing_if = "Option::is_none")]
17 pub iefmin: Option<f64>,
18 #[serde(skip_serializing_if = "Option::is_none")]
20 pub k1: Option<f64>,
21 #[serde(skip_serializing_if = "Option::is_none")]
23 pub k1ec: Option<f64>,
24 #[serde(skip_serializing_if = "Option::is_none")]
26 pub k2: Option<f64>,
27 #[serde(skip_serializing_if = "Option::is_none")]
29 pub k3: Option<f64>,
30 #[serde(skip_serializing_if = "Option::is_none")]
32 pub k4: Option<f64>,
33 #[serde(skip_serializing_if = "Option::is_none")]
35 pub kd1: Option<f64>,
36 #[serde(skip_serializing_if = "Option::is_none")]
38 pub ke2: Option<f64>,
39 #[serde(skip_serializing_if = "Option::is_none")]
41 pub ketb: Option<f64>,
42 #[serde(skip_serializing_if = "Option::is_none")]
44 pub pid1max: Option<f64>,
45 #[serde(skip_serializing_if = "Option::is_none")]
47 pub seve1: Option<f64>,
48 #[serde(skip_serializing_if = "Option::is_none")]
50 pub seve2: Option<f64>,
51 #[serde(skip_serializing_if = "Option::is_none")]
53 pub tb1: Option<f64>,
54 #[serde(skip_serializing_if = "Option::is_none")]
56 pub te: Option<f64>,
57 #[serde(skip_serializing_if = "Option::is_none")]
59 pub te2: Option<f64>,
60 #[serde(skip_serializing_if = "Option::is_none")]
62 pub ti1: Option<f64>,
63 #[serde(skip_serializing_if = "Option::is_none")]
65 pub ti3: Option<f64>,
66 #[serde(skip_serializing_if = "Option::is_none")]
68 pub ti4: Option<f64>,
69 #[serde(skip_serializing_if = "Option::is_none")]
71 pub tr4: Option<f64>,
72 #[serde(skip_serializing_if = "Option::is_none")]
74 pub upmax: Option<f64>,
75 #[serde(skip_serializing_if = "Option::is_none")]
77 pub upmin: Option<f64>,
78 #[serde(skip_serializing_if = "Option::is_none")]
80 pub ve1: Option<f64>,
81 #[serde(skip_serializing_if = "Option::is_none")]
83 pub ve2: Option<f64>,
84 #[serde(skip_serializing_if = "Option::is_none")]
86 pub xp: Option<f64>,
87}
88impl crate::base::CimElement for ExcELIN2 {
89 fn mrid(&self) -> &str { &self.base.base.base.id }
90 fn type_name(&self) -> &'static str { "ExcELIN2" }
91 fn as_any(&self) -> &dyn std::any::Any { self }
92 fn to_json_value(&self) -> serde_json::Value {
93 serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
94 }
95 fn to_block(&self) -> crate::base::RdfBlock {
96 let mut block = self.base.to_block();
97 block.type_name = "ExcELIN2".to_string();
98 if let Some(v) = self.efdbas {
99 block.fields.insert("ExcELIN2.efdbas".into(), crate::base::FieldValue::Text(v.to_string()));
100 }
101 if let Some(v) = self.iefmax {
102 block.fields.insert("ExcELIN2.iefmax".into(), crate::base::FieldValue::Text(v.to_string()));
103 }
104 if let Some(v) = self.iefmax2 {
105 block.fields.insert("ExcELIN2.iefmax2".into(), crate::base::FieldValue::Text(v.to_string()));
106 }
107 if let Some(v) = self.iefmin {
108 block.fields.insert("ExcELIN2.iefmin".into(), crate::base::FieldValue::Text(v.to_string()));
109 }
110 if let Some(v) = self.k1 {
111 block.fields.insert("ExcELIN2.k1".into(), crate::base::FieldValue::Text(v.to_string()));
112 }
113 if let Some(v) = self.k1ec {
114 block.fields.insert("ExcELIN2.k1ec".into(), crate::base::FieldValue::Text(v.to_string()));
115 }
116 if let Some(v) = self.k2 {
117 block.fields.insert("ExcELIN2.k2".into(), crate::base::FieldValue::Text(v.to_string()));
118 }
119 if let Some(v) = self.k3 {
120 block.fields.insert("ExcELIN2.k3".into(), crate::base::FieldValue::Text(v.to_string()));
121 }
122 if let Some(v) = self.k4 {
123 block.fields.insert("ExcELIN2.k4".into(), crate::base::FieldValue::Text(v.to_string()));
124 }
125 if let Some(v) = self.kd1 {
126 block.fields.insert("ExcELIN2.kd1".into(), crate::base::FieldValue::Text(v.to_string()));
127 }
128 if let Some(v) = self.ke2 {
129 block.fields.insert("ExcELIN2.ke2".into(), crate::base::FieldValue::Text(v.to_string()));
130 }
131 if let Some(v) = self.ketb {
132 block.fields.insert("ExcELIN2.ketb".into(), crate::base::FieldValue::Text(v.to_string()));
133 }
134 if let Some(v) = self.pid1max {
135 block.fields.insert("ExcELIN2.pid1max".into(), crate::base::FieldValue::Text(v.to_string()));
136 }
137 if let Some(v) = self.seve1 {
138 block.fields.insert("ExcELIN2.seve1".into(), crate::base::FieldValue::Text(v.to_string()));
139 }
140 if let Some(v) = self.seve2 {
141 block.fields.insert("ExcELIN2.seve2".into(), crate::base::FieldValue::Text(v.to_string()));
142 }
143 if let Some(v) = self.tb1 {
144 block.fields.insert("ExcELIN2.tb1".into(), crate::base::FieldValue::Text(v.to_string()));
145 }
146 if let Some(v) = self.te {
147 block.fields.insert("ExcELIN2.te".into(), crate::base::FieldValue::Text(v.to_string()));
148 }
149 if let Some(v) = self.te2 {
150 block.fields.insert("ExcELIN2.te2".into(), crate::base::FieldValue::Text(v.to_string()));
151 }
152 if let Some(v) = self.ti1 {
153 block.fields.insert("ExcELIN2.ti1".into(), crate::base::FieldValue::Text(v.to_string()));
154 }
155 if let Some(v) = self.ti3 {
156 block.fields.insert("ExcELIN2.ti3".into(), crate::base::FieldValue::Text(v.to_string()));
157 }
158 if let Some(v) = self.ti4 {
159 block.fields.insert("ExcELIN2.ti4".into(), crate::base::FieldValue::Text(v.to_string()));
160 }
161 if let Some(v) = self.tr4 {
162 block.fields.insert("ExcELIN2.tr4".into(), crate::base::FieldValue::Text(v.to_string()));
163 }
164 if let Some(v) = self.upmax {
165 block.fields.insert("ExcELIN2.upmax".into(), crate::base::FieldValue::Text(v.to_string()));
166 }
167 if let Some(v) = self.upmin {
168 block.fields.insert("ExcELIN2.upmin".into(), crate::base::FieldValue::Text(v.to_string()));
169 }
170 if let Some(v) = self.ve1 {
171 block.fields.insert("ExcELIN2.ve1".into(), crate::base::FieldValue::Text(v.to_string()));
172 }
173 if let Some(v) = self.ve2 {
174 block.fields.insert("ExcELIN2.ve2".into(), crate::base::FieldValue::Text(v.to_string()));
175 }
176 if let Some(v) = self.xp {
177 block.fields.insert("ExcELIN2.xp".into(), crate::base::FieldValue::Text(v.to_string()));
178 }
179 block
180 }
181}
182
183impl ExcELIN2 {
184 pub fn from_block(b: &crate::base::RdfBlock) -> Self {
185 let mut obj = Self::default();
186 obj.base.base.base.id.clone_from(&b.mrid);
187 for (key, val) in &b.fields {
188 match key.as_str() {
189 "ExcELIN2.efdbas" => {
190 match val {
191 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.efdbas = Some(v); } }
192 crate::base::FieldValue::TextList(svs) => {
193 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.efdbas = Some(v); } }
194 }
195 _ => {}
196 }
197 }
198 "ExcELIN2.iefmax" => {
199 match val {
200 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.iefmax = Some(v); } }
201 crate::base::FieldValue::TextList(svs) => {
202 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.iefmax = Some(v); } }
203 }
204 _ => {}
205 }
206 }
207 "ExcELIN2.iefmax2" => {
208 match val {
209 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.iefmax2 = Some(v); } }
210 crate::base::FieldValue::TextList(svs) => {
211 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.iefmax2 = Some(v); } }
212 }
213 _ => {}
214 }
215 }
216 "ExcELIN2.iefmin" => {
217 match val {
218 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.iefmin = Some(v); } }
219 crate::base::FieldValue::TextList(svs) => {
220 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.iefmin = Some(v); } }
221 }
222 _ => {}
223 }
224 }
225 "ExcELIN2.k1" => {
226 match val {
227 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k1 = Some(v); } }
228 crate::base::FieldValue::TextList(svs) => {
229 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k1 = Some(v); } }
230 }
231 _ => {}
232 }
233 }
234 "ExcELIN2.k1ec" => {
235 match val {
236 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k1ec = Some(v); } }
237 crate::base::FieldValue::TextList(svs) => {
238 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k1ec = Some(v); } }
239 }
240 _ => {}
241 }
242 }
243 "ExcELIN2.k2" => {
244 match val {
245 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k2 = Some(v); } }
246 crate::base::FieldValue::TextList(svs) => {
247 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k2 = Some(v); } }
248 }
249 _ => {}
250 }
251 }
252 "ExcELIN2.k3" => {
253 match val {
254 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k3 = Some(v); } }
255 crate::base::FieldValue::TextList(svs) => {
256 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k3 = Some(v); } }
257 }
258 _ => {}
259 }
260 }
261 "ExcELIN2.k4" => {
262 match val {
263 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.k4 = Some(v); } }
264 crate::base::FieldValue::TextList(svs) => {
265 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.k4 = Some(v); } }
266 }
267 _ => {}
268 }
269 }
270 "ExcELIN2.kd1" => {
271 match val {
272 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kd1 = Some(v); } }
273 crate::base::FieldValue::TextList(svs) => {
274 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kd1 = Some(v); } }
275 }
276 _ => {}
277 }
278 }
279 "ExcELIN2.ke2" => {
280 match val {
281 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ke2 = Some(v); } }
282 crate::base::FieldValue::TextList(svs) => {
283 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ke2 = Some(v); } }
284 }
285 _ => {}
286 }
287 }
288 "ExcELIN2.ketb" => {
289 match val {
290 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ketb = Some(v); } }
291 crate::base::FieldValue::TextList(svs) => {
292 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ketb = Some(v); } }
293 }
294 _ => {}
295 }
296 }
297 "ExcELIN2.pid1max" => {
298 match val {
299 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.pid1max = Some(v); } }
300 crate::base::FieldValue::TextList(svs) => {
301 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.pid1max = Some(v); } }
302 }
303 _ => {}
304 }
305 }
306 "ExcELIN2.seve1" => {
307 match val {
308 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seve1 = Some(v); } }
309 crate::base::FieldValue::TextList(svs) => {
310 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seve1 = Some(v); } }
311 }
312 _ => {}
313 }
314 }
315 "ExcELIN2.seve2" => {
316 match val {
317 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.seve2 = Some(v); } }
318 crate::base::FieldValue::TextList(svs) => {
319 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.seve2 = Some(v); } }
320 }
321 _ => {}
322 }
323 }
324 "ExcELIN2.tb1" => {
325 match val {
326 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tb1 = Some(v); } }
327 crate::base::FieldValue::TextList(svs) => {
328 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tb1 = Some(v); } }
329 }
330 _ => {}
331 }
332 }
333 "ExcELIN2.te" => {
334 match val {
335 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
336 crate::base::FieldValue::TextList(svs) => {
337 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.te = Some(v); } }
338 }
339 _ => {}
340 }
341 }
342 "ExcELIN2.te2" => {
343 match val {
344 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.te2 = Some(v); } }
345 crate::base::FieldValue::TextList(svs) => {
346 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.te2 = Some(v); } }
347 }
348 _ => {}
349 }
350 }
351 "ExcELIN2.ti1" => {
352 match val {
353 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ti1 = Some(v); } }
354 crate::base::FieldValue::TextList(svs) => {
355 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ti1 = Some(v); } }
356 }
357 _ => {}
358 }
359 }
360 "ExcELIN2.ti3" => {
361 match val {
362 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ti3 = Some(v); } }
363 crate::base::FieldValue::TextList(svs) => {
364 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ti3 = Some(v); } }
365 }
366 _ => {}
367 }
368 }
369 "ExcELIN2.ti4" => {
370 match val {
371 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ti4 = Some(v); } }
372 crate::base::FieldValue::TextList(svs) => {
373 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ti4 = Some(v); } }
374 }
375 _ => {}
376 }
377 }
378 "ExcELIN2.tr4" => {
379 match val {
380 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tr4 = Some(v); } }
381 crate::base::FieldValue::TextList(svs) => {
382 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tr4 = Some(v); } }
383 }
384 _ => {}
385 }
386 }
387 "ExcELIN2.upmax" => {
388 match val {
389 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.upmax = Some(v); } }
390 crate::base::FieldValue::TextList(svs) => {
391 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.upmax = Some(v); } }
392 }
393 _ => {}
394 }
395 }
396 "ExcELIN2.upmin" => {
397 match val {
398 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.upmin = Some(v); } }
399 crate::base::FieldValue::TextList(svs) => {
400 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.upmin = Some(v); } }
401 }
402 _ => {}
403 }
404 }
405 "ExcELIN2.ve1" => {
406 match val {
407 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ve1 = Some(v); } }
408 crate::base::FieldValue::TextList(svs) => {
409 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ve1 = Some(v); } }
410 }
411 _ => {}
412 }
413 }
414 "ExcELIN2.ve2" => {
415 match val {
416 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ve2 = Some(v); } }
417 crate::base::FieldValue::TextList(svs) => {
418 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ve2 = Some(v); } }
419 }
420 _ => {}
421 }
422 }
423 "ExcELIN2.xp" => {
424 match val {
425 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.xp = Some(v); } }
426 crate::base::FieldValue::TextList(svs) => {
427 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.xp = Some(v); } }
428 }
429 _ => {}
430 }
431 }
432 "ExcitationSystemDynamics.SynchronousMachineDynamics" => {
433 if let crate::base::FieldValue::Resource(sv) = val {
434 obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
435 }
436 }
437 "DynamicsFunctionBlock.enabled" => {
438 match val {
439 crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
440 crate::base::FieldValue::TextList(svs) => {
441 if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
442 }
443 _ => {}
444 }
445 }
446 "IdentifiedObject.description" => {
447 match val {
448 crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
449 crate::base::FieldValue::TextList(svs) => {
450 if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
451 }
452 _ => {}
453 }
454 }
455 "IdentifiedObject.energyIdentCodeEic" => {
456 match val {
457 crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
458 crate::base::FieldValue::TextList(svs) => {
459 if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
460 }
461 _ => {}
462 }
463 }
464 "IdentifiedObject.mRID" => {
465 match val {
466 crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
467 crate::base::FieldValue::TextList(svs) => {
468 if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
469 }
470 _ => {}
471 }
472 }
473 "IdentifiedObject.name" => {
474 match val {
475 crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
476 crate::base::FieldValue::TextList(svs) => {
477 if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
478 }
479 _ => {}
480 }
481 }
482 "IdentifiedObject.shortName" => {
483 match val {
484 crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
485 crate::base::FieldValue::TextList(svs) => {
486 if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
487 }
488 _ => {}
489 }
490 }
491 _ => {}
492 }
493 }
494 obj
495 }
496}