1#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct ExcST6B {
4 #[serde(flatten)]
5 pub base: super::ExcitationSystemDynamics,
6 #[serde(skip_serializing_if = "Option::is_none")]
8 pub ilr: Option<f64>,
9 #[serde(skip_serializing_if = "Option::is_none")]
11 pub k1: Option<bool>,
12 #[serde(skip_serializing_if = "Option::is_none")]
14 pub kcl: Option<f64>,
15 #[serde(skip_serializing_if = "Option::is_none")]
17 pub kff: Option<f64>,
18 #[serde(skip_serializing_if = "Option::is_none")]
20 pub kg: Option<f64>,
21 #[serde(skip_serializing_if = "Option::is_none")]
23 pub kia: Option<f64>,
24 #[serde(skip_serializing_if = "Option::is_none")]
26 pub klr: Option<f64>,
27 #[serde(skip_serializing_if = "Option::is_none")]
29 pub km: Option<f64>,
30 #[serde(skip_serializing_if = "Option::is_none")]
32 pub kpa: Option<f64>,
33 #[serde(skip_serializing_if = "Option::is_none")]
35 pub kvd: Option<f64>,
36 #[serde(skip_serializing_if = "Option::is_none")]
38 pub oelin: Option<super::base::UriRef>,
39 #[serde(skip_serializing_if = "Option::is_none")]
41 pub tg: Option<f64>,
42 #[serde(skip_serializing_if = "Option::is_none")]
44 pub ts: Option<f64>,
45 #[serde(skip_serializing_if = "Option::is_none")]
47 pub tvd: Option<f64>,
48 #[serde(skip_serializing_if = "Option::is_none")]
50 pub vamax: Option<f64>,
51 #[serde(skip_serializing_if = "Option::is_none")]
53 pub vamin: Option<f64>,
54 #[serde(skip_serializing_if = "Option::is_none")]
56 pub vilim: Option<bool>,
57 #[serde(skip_serializing_if = "Option::is_none")]
59 pub vimax: Option<f64>,
60 #[serde(skip_serializing_if = "Option::is_none")]
62 pub vimin: Option<f64>,
63 #[serde(skip_serializing_if = "Option::is_none")]
65 pub vmult: Option<bool>,
66 #[serde(skip_serializing_if = "Option::is_none")]
68 pub vrmax: Option<f64>,
69 #[serde(skip_serializing_if = "Option::is_none")]
71 pub vrmin: Option<f64>,
72 #[serde(skip_serializing_if = "Option::is_none")]
74 pub xc: Option<f64>,
75}
76impl crate::base::CimElement for ExcST6B {
77 fn mrid(&self) -> &str { &self.base.base.base.id }
78 fn type_name(&self) -> &'static str { "ExcST6B" }
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 = "ExcST6B".to_string();
86 if let Some(v) = self.ilr {
87 block.fields.insert("ExcST6B.ilr".into(), crate::base::FieldValue::Text(v.to_string()));
88 }
89 if let Some(v) = self.k1 {
90 block.fields.insert("ExcST6B.k1".into(), crate::base::FieldValue::Text(v.to_string()));
91 }
92 if let Some(v) = self.kcl {
93 block.fields.insert("ExcST6B.kcl".into(), crate::base::FieldValue::Text(v.to_string()));
94 }
95 if let Some(v) = self.kff {
96 block.fields.insert("ExcST6B.kff".into(), crate::base::FieldValue::Text(v.to_string()));
97 }
98 if let Some(v) = self.kg {
99 block.fields.insert("ExcST6B.kg".into(), crate::base::FieldValue::Text(v.to_string()));
100 }
101 if let Some(v) = self.kia {
102 block.fields.insert("ExcST6B.kia".into(), crate::base::FieldValue::Text(v.to_string()));
103 }
104 if let Some(v) = self.klr {
105 block.fields.insert("ExcST6B.klr".into(), crate::base::FieldValue::Text(v.to_string()));
106 }
107 if let Some(v) = self.km {
108 block.fields.insert("ExcST6B.km".into(), crate::base::FieldValue::Text(v.to_string()));
109 }
110 if let Some(v) = self.kpa {
111 block.fields.insert("ExcST6B.kpa".into(), crate::base::FieldValue::Text(v.to_string()));
112 }
113 if let Some(v) = self.kvd {
114 block.fields.insert("ExcST6B.kvd".into(), crate::base::FieldValue::Text(v.to_string()));
115 }
116 if let Some(ref v) = self.oelin {
117 block.fields.insert("ExcST6B.oelin".into(), crate::base::FieldValue::Resource(v.uri.clone()));
118 }
119 if let Some(v) = self.tg {
120 block.fields.insert("ExcST6B.tg".into(), crate::base::FieldValue::Text(v.to_string()));
121 }
122 if let Some(v) = self.ts {
123 block.fields.insert("ExcST6B.ts".into(), crate::base::FieldValue::Text(v.to_string()));
124 }
125 if let Some(v) = self.tvd {
126 block.fields.insert("ExcST6B.tvd".into(), crate::base::FieldValue::Text(v.to_string()));
127 }
128 if let Some(v) = self.vamax {
129 block.fields.insert("ExcST6B.vamax".into(), crate::base::FieldValue::Text(v.to_string()));
130 }
131 if let Some(v) = self.vamin {
132 block.fields.insert("ExcST6B.vamin".into(), crate::base::FieldValue::Text(v.to_string()));
133 }
134 if let Some(v) = self.vilim {
135 block.fields.insert("ExcST6B.vilim".into(), crate::base::FieldValue::Text(v.to_string()));
136 }
137 if let Some(v) = self.vimax {
138 block.fields.insert("ExcST6B.vimax".into(), crate::base::FieldValue::Text(v.to_string()));
139 }
140 if let Some(v) = self.vimin {
141 block.fields.insert("ExcST6B.vimin".into(), crate::base::FieldValue::Text(v.to_string()));
142 }
143 if let Some(v) = self.vmult {
144 block.fields.insert("ExcST6B.vmult".into(), crate::base::FieldValue::Text(v.to_string()));
145 }
146 if let Some(v) = self.vrmax {
147 block.fields.insert("ExcST6B.vrmax".into(), crate::base::FieldValue::Text(v.to_string()));
148 }
149 if let Some(v) = self.vrmin {
150 block.fields.insert("ExcST6B.vrmin".into(), crate::base::FieldValue::Text(v.to_string()));
151 }
152 if let Some(v) = self.xc {
153 block.fields.insert("ExcST6B.xc".into(), crate::base::FieldValue::Text(v.to_string()));
154 }
155 block
156 }
157}
158
159impl ExcST6B {
160 pub fn from_block(b: &crate::base::RdfBlock) -> Self {
161 let mut obj = Self::default();
162 obj.base.base.base.id.clone_from(&b.mrid);
163 for (key, val) in &b.fields {
164 match key.as_str() {
165 "ExcST6B.ilr" => {
166 match val {
167 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ilr = Some(v); } }
168 crate::base::FieldValue::TextList(svs) => {
169 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ilr = Some(v); } }
170 }
171 _ => {}
172 }
173 }
174 "ExcST6B.k1" => {
175 match val {
176 crate::base::FieldValue::Text(sv) => { obj.k1 = Some(sv.trim() == "true"); }
177 crate::base::FieldValue::TextList(svs) => {
178 if let Some(sv) = svs.last() { obj.k1 = Some(sv.trim() == "true"); }
179 }
180 _ => {}
181 }
182 }
183 "ExcST6B.kcl" => {
184 match val {
185 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kcl = Some(v); } }
186 crate::base::FieldValue::TextList(svs) => {
187 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kcl = Some(v); } }
188 }
189 _ => {}
190 }
191 }
192 "ExcST6B.kff" => {
193 match val {
194 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kff = Some(v); } }
195 crate::base::FieldValue::TextList(svs) => {
196 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kff = Some(v); } }
197 }
198 _ => {}
199 }
200 }
201 "ExcST6B.kg" => {
202 match val {
203 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kg = Some(v); } }
204 crate::base::FieldValue::TextList(svs) => {
205 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kg = Some(v); } }
206 }
207 _ => {}
208 }
209 }
210 "ExcST6B.kia" => {
211 match val {
212 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kia = Some(v); } }
213 crate::base::FieldValue::TextList(svs) => {
214 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kia = Some(v); } }
215 }
216 _ => {}
217 }
218 }
219 "ExcST6B.klr" => {
220 match val {
221 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.klr = Some(v); } }
222 crate::base::FieldValue::TextList(svs) => {
223 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.klr = Some(v); } }
224 }
225 _ => {}
226 }
227 }
228 "ExcST6B.km" => {
229 match val {
230 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.km = Some(v); } }
231 crate::base::FieldValue::TextList(svs) => {
232 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.km = Some(v); } }
233 }
234 _ => {}
235 }
236 }
237 "ExcST6B.kpa" => {
238 match val {
239 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kpa = Some(v); } }
240 crate::base::FieldValue::TextList(svs) => {
241 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kpa = Some(v); } }
242 }
243 _ => {}
244 }
245 }
246 "ExcST6B.kvd" => {
247 match val {
248 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.kvd = Some(v); } }
249 crate::base::FieldValue::TextList(svs) => {
250 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.kvd = Some(v); } }
251 }
252 _ => {}
253 }
254 }
255 "ExcST6B.oelin" => {
256 if let crate::base::FieldValue::Resource(sv) = val {
257 obj.oelin = Some(crate::base::UriRef { uri: sv.clone() });
258 }
259 }
260 "ExcST6B.tg" => {
261 match val {
262 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tg = Some(v); } }
263 crate::base::FieldValue::TextList(svs) => {
264 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tg = Some(v); } }
265 }
266 _ => {}
267 }
268 }
269 "ExcST6B.ts" => {
270 match val {
271 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.ts = Some(v); } }
272 crate::base::FieldValue::TextList(svs) => {
273 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.ts = Some(v); } }
274 }
275 _ => {}
276 }
277 }
278 "ExcST6B.tvd" => {
279 match val {
280 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tvd = Some(v); } }
281 crate::base::FieldValue::TextList(svs) => {
282 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tvd = Some(v); } }
283 }
284 _ => {}
285 }
286 }
287 "ExcST6B.vamax" => {
288 match val {
289 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vamax = Some(v); } }
290 crate::base::FieldValue::TextList(svs) => {
291 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vamax = Some(v); } }
292 }
293 _ => {}
294 }
295 }
296 "ExcST6B.vamin" => {
297 match val {
298 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vamin = Some(v); } }
299 crate::base::FieldValue::TextList(svs) => {
300 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vamin = Some(v); } }
301 }
302 _ => {}
303 }
304 }
305 "ExcST6B.vilim" => {
306 match val {
307 crate::base::FieldValue::Text(sv) => { obj.vilim = Some(sv.trim() == "true"); }
308 crate::base::FieldValue::TextList(svs) => {
309 if let Some(sv) = svs.last() { obj.vilim = Some(sv.trim() == "true"); }
310 }
311 _ => {}
312 }
313 }
314 "ExcST6B.vimax" => {
315 match val {
316 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vimax = Some(v); } }
317 crate::base::FieldValue::TextList(svs) => {
318 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vimax = Some(v); } }
319 }
320 _ => {}
321 }
322 }
323 "ExcST6B.vimin" => {
324 match val {
325 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vimin = Some(v); } }
326 crate::base::FieldValue::TextList(svs) => {
327 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vimin = Some(v); } }
328 }
329 _ => {}
330 }
331 }
332 "ExcST6B.vmult" => {
333 match val {
334 crate::base::FieldValue::Text(sv) => { obj.vmult = Some(sv.trim() == "true"); }
335 crate::base::FieldValue::TextList(svs) => {
336 if let Some(sv) = svs.last() { obj.vmult = Some(sv.trim() == "true"); }
337 }
338 _ => {}
339 }
340 }
341 "ExcST6B.vrmax" => {
342 match val {
343 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
344 crate::base::FieldValue::TextList(svs) => {
345 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmax = Some(v); } }
346 }
347 _ => {}
348 }
349 }
350 "ExcST6B.vrmin" => {
351 match val {
352 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
353 crate::base::FieldValue::TextList(svs) => {
354 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vrmin = Some(v); } }
355 }
356 _ => {}
357 }
358 }
359 "ExcST6B.xc" => {
360 match val {
361 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.xc = Some(v); } }
362 crate::base::FieldValue::TextList(svs) => {
363 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.xc = Some(v); } }
364 }
365 _ => {}
366 }
367 }
368 "ExcitationSystemDynamics.SynchronousMachineDynamics" => {
369 if let crate::base::FieldValue::Resource(sv) = val {
370 obj.base.synchronous_machine_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
371 }
372 }
373 "DynamicsFunctionBlock.enabled" => {
374 match val {
375 crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
376 crate::base::FieldValue::TextList(svs) => {
377 if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
378 }
379 _ => {}
380 }
381 }
382 "IdentifiedObject.description" => {
383 match val {
384 crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
385 crate::base::FieldValue::TextList(svs) => {
386 if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
387 }
388 _ => {}
389 }
390 }
391 "IdentifiedObject.energyIdentCodeEic" => {
392 match val {
393 crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
394 crate::base::FieldValue::TextList(svs) => {
395 if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
396 }
397 _ => {}
398 }
399 }
400 "IdentifiedObject.mRID" => {
401 match val {
402 crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
403 crate::base::FieldValue::TextList(svs) => {
404 if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
405 }
406 _ => {}
407 }
408 }
409 "IdentifiedObject.name" => {
410 match val {
411 crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
412 crate::base::FieldValue::TextList(svs) => {
413 if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
414 }
415 _ => {}
416 }
417 }
418 "IdentifiedObject.shortName" => {
419 match val {
420 crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
421 crate::base::FieldValue::TextList(svs) => {
422 if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
423 }
424 _ => {}
425 }
426 }
427 _ => {}
428 }
429 }
430 obj
431 }
432}