cimstructs/
PFVArType1IEEEPFController.rs1#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct PFVArType1IEEEPFController {
4 #[serde(flatten)]
5 pub base: super::PFVArControllerType1Dynamics,
6 #[serde(skip_serializing_if = "Option::is_none")]
8 pub ovex: Option<bool>,
9 #[serde(skip_serializing_if = "Option::is_none")]
11 pub tpfc: Option<f64>,
12 #[serde(skip_serializing_if = "Option::is_none")]
14 pub vitmin: Option<f64>,
15 #[serde(skip_serializing_if = "Option::is_none")]
17 pub vpf: Option<f64>,
18 #[serde(skip_serializing_if = "Option::is_none")]
20 pub vpfcbw: Option<f64>,
21 #[serde(skip_serializing_if = "Option::is_none")]
23 pub vpfref: Option<f64>,
24 #[serde(skip_serializing_if = "Option::is_none")]
26 pub vvtmax: Option<f64>,
27 #[serde(skip_serializing_if = "Option::is_none")]
29 pub vvtmin: Option<f64>,
30}
31impl crate::base::CimElement for PFVArType1IEEEPFController {
32 fn mrid(&self) -> &str { &self.base.base.base.id }
33 fn type_name(&self) -> &'static str { "PFVArType1IEEEPFController" }
34 fn as_any(&self) -> &dyn std::any::Any { self }
35 fn to_json_value(&self) -> serde_json::Value {
36 serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
37 }
38 fn to_block(&self) -> crate::base::RdfBlock {
39 let mut block = self.base.to_block();
40 block.type_name = "PFVArType1IEEEPFController".to_string();
41 if let Some(v) = self.ovex {
42 block.fields.insert("PFVArType1IEEEPFController.ovex".into(), crate::base::FieldValue::Text(v.to_string()));
43 }
44 if let Some(v) = self.tpfc {
45 block.fields.insert("PFVArType1IEEEPFController.tpfc".into(), crate::base::FieldValue::Text(v.to_string()));
46 }
47 if let Some(v) = self.vitmin {
48 block.fields.insert("PFVArType1IEEEPFController.vitmin".into(), crate::base::FieldValue::Text(v.to_string()));
49 }
50 if let Some(v) = self.vpf {
51 block.fields.insert("PFVArType1IEEEPFController.vpf".into(), crate::base::FieldValue::Text(v.to_string()));
52 }
53 if let Some(v) = self.vpfcbw {
54 block.fields.insert("PFVArType1IEEEPFController.vpfcbw".into(), crate::base::FieldValue::Text(v.to_string()));
55 }
56 if let Some(v) = self.vpfref {
57 block.fields.insert("PFVArType1IEEEPFController.vpfref".into(), crate::base::FieldValue::Text(v.to_string()));
58 }
59 if let Some(v) = self.vvtmax {
60 block.fields.insert("PFVArType1IEEEPFController.vvtmax".into(), crate::base::FieldValue::Text(v.to_string()));
61 }
62 if let Some(v) = self.vvtmin {
63 block.fields.insert("PFVArType1IEEEPFController.vvtmin".into(), crate::base::FieldValue::Text(v.to_string()));
64 }
65 block
66 }
67}
68
69impl PFVArType1IEEEPFController {
70 pub fn from_block(b: &crate::base::RdfBlock) -> Self {
71 let mut obj = Self::default();
72 obj.base.base.base.id.clone_from(&b.mrid);
73 for (key, val) in &b.fields {
74 match key.as_str() {
75 "PFVArType1IEEEPFController.ovex" => {
76 match val {
77 crate::base::FieldValue::Text(sv) => { obj.ovex = Some(sv.trim() == "true"); }
78 crate::base::FieldValue::TextList(svs) => {
79 if let Some(sv) = svs.last() { obj.ovex = Some(sv.trim() == "true"); }
80 }
81 _ => {}
82 }
83 }
84 "PFVArType1IEEEPFController.tpfc" => {
85 match val {
86 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tpfc = Some(v); } }
87 crate::base::FieldValue::TextList(svs) => {
88 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tpfc = Some(v); } }
89 }
90 _ => {}
91 }
92 }
93 "PFVArType1IEEEPFController.vitmin" => {
94 match val {
95 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vitmin = Some(v); } }
96 crate::base::FieldValue::TextList(svs) => {
97 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vitmin = Some(v); } }
98 }
99 _ => {}
100 }
101 }
102 "PFVArType1IEEEPFController.vpf" => {
103 match val {
104 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vpf = Some(v); } }
105 crate::base::FieldValue::TextList(svs) => {
106 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vpf = Some(v); } }
107 }
108 _ => {}
109 }
110 }
111 "PFVArType1IEEEPFController.vpfcbw" => {
112 match val {
113 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vpfcbw = Some(v); } }
114 crate::base::FieldValue::TextList(svs) => {
115 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vpfcbw = Some(v); } }
116 }
117 _ => {}
118 }
119 }
120 "PFVArType1IEEEPFController.vpfref" => {
121 match val {
122 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vpfref = Some(v); } }
123 crate::base::FieldValue::TextList(svs) => {
124 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vpfref = Some(v); } }
125 }
126 _ => {}
127 }
128 }
129 "PFVArType1IEEEPFController.vvtmax" => {
130 match val {
131 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vvtmax = Some(v); } }
132 crate::base::FieldValue::TextList(svs) => {
133 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vvtmax = Some(v); } }
134 }
135 _ => {}
136 }
137 }
138 "PFVArType1IEEEPFController.vvtmin" => {
139 match val {
140 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.vvtmin = Some(v); } }
141 crate::base::FieldValue::TextList(svs) => {
142 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.vvtmin = Some(v); } }
143 }
144 _ => {}
145 }
146 }
147 "PFVArControllerType1Dynamics.ExcitationSystemDynamics" => {
148 if let crate::base::FieldValue::Resource(sv) = val {
149 obj.base.excitation_system_dynamics = Some(crate::base::MridRef { mrid: sv.clone() });
150 }
151 }
152 "DynamicsFunctionBlock.enabled" => {
153 match val {
154 crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
155 crate::base::FieldValue::TextList(svs) => {
156 if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
157 }
158 _ => {}
159 }
160 }
161 "IdentifiedObject.description" => {
162 match val {
163 crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
164 crate::base::FieldValue::TextList(svs) => {
165 if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
166 }
167 _ => {}
168 }
169 }
170 "IdentifiedObject.energyIdentCodeEic" => {
171 match val {
172 crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
173 crate::base::FieldValue::TextList(svs) => {
174 if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
175 }
176 _ => {}
177 }
178 }
179 "IdentifiedObject.mRID" => {
180 match val {
181 crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
182 crate::base::FieldValue::TextList(svs) => {
183 if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
184 }
185 _ => {}
186 }
187 }
188 "IdentifiedObject.name" => {
189 match val {
190 crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
191 crate::base::FieldValue::TextList(svs) => {
192 if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
193 }
194 _ => {}
195 }
196 }
197 "IdentifiedObject.shortName" => {
198 match val {
199 crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
200 crate::base::FieldValue::TextList(svs) => {
201 if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
202 }
203 _ => {}
204 }
205 }
206 _ => {}
207 }
208 }
209 obj
210 }
211}