cimstructs/
WindPlantIEC.rs1#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct WindPlantIEC {
4 #[serde(flatten)]
5 pub base: super::WindPlantDynamics,
6 #[serde(skip_serializing_if = "Option::is_none")]
8 pub wind_plant_freq_pcontrol_iec: Option<super::base::MridRef>,
9 #[serde(skip_serializing_if = "Option::is_none")]
11 pub wind_plant_reactive_control_iec: Option<super::base::MridRef>,
12}
13impl crate::base::CimElement for WindPlantIEC {
14 fn mrid(&self) -> &str { &self.base.base.base.id }
15 fn type_name(&self) -> &'static str { "WindPlantIEC" }
16 fn as_any(&self) -> &dyn std::any::Any { self }
17 fn to_json_value(&self) -> serde_json::Value {
18 serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
19 }
20 fn to_block(&self) -> crate::base::RdfBlock {
21 let mut block = self.base.to_block();
22 block.type_name = "WindPlantIEC".to_string();
23 if let Some(ref v) = self.wind_plant_freq_pcontrol_iec {
24 block.fields.insert("WindPlantIEC.WindPlantFreqPcontrolIEC".into(), crate::base::FieldValue::Resource(v.mrid.clone()));
25 }
26 if let Some(ref v) = self.wind_plant_reactive_control_iec {
27 block.fields.insert("WindPlantIEC.WindPlantReactiveControlIEC".into(), crate::base::FieldValue::Resource(v.mrid.clone()));
28 }
29 block
30 }
31}
32
33impl WindPlantIEC {
34 pub fn from_block(b: &crate::base::RdfBlock) -> Self {
35 let mut obj = Self::default();
36 obj.base.base.base.id.clone_from(&b.mrid);
37 for (key, val) in &b.fields {
38 match key.as_str() {
39 "WindPlantIEC.WindPlantFreqPcontrolIEC" => {
40 if let crate::base::FieldValue::Resource(sv) = val {
41 obj.wind_plant_freq_pcontrol_iec = Some(crate::base::MridRef { mrid: sv.clone() });
42 }
43 }
44 "WindPlantIEC.WindPlantReactiveControlIEC" => {
45 if let crate::base::FieldValue::Resource(sv) = val {
46 obj.wind_plant_reactive_control_iec = Some(crate::base::MridRef { mrid: sv.clone() });
47 }
48 }
49 "WindPlantDynamics.RemoteInputSignal" => {
50 if let crate::base::FieldValue::Resource(sv) = val {
51 obj.base.remote_input_signal = Some(crate::base::MridRef { mrid: sv.clone() });
52 }
53 }
54 "DynamicsFunctionBlock.enabled" => {
55 match val {
56 crate::base::FieldValue::Text(sv) => { obj.base.base.enabled = Some(sv.trim() == "true"); }
57 crate::base::FieldValue::TextList(svs) => {
58 if let Some(sv) = svs.last() { obj.base.base.enabled = Some(sv.trim() == "true"); }
59 }
60 _ => {}
61 }
62 }
63 "IdentifiedObject.description" => {
64 match val {
65 crate::base::FieldValue::Text(sv) => { obj.base.base.base.description = sv.clone(); }
66 crate::base::FieldValue::TextList(svs) => {
67 if let Some(sv) = svs.last() { obj.base.base.base.description = sv.clone(); }
68 }
69 _ => {}
70 }
71 }
72 "IdentifiedObject.energyIdentCodeEic" => {
73 match val {
74 crate::base::FieldValue::Text(sv) => { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
75 crate::base::FieldValue::TextList(svs) => {
76 if let Some(sv) = svs.last() { obj.base.base.base.energy_ident_code_eic = sv.clone(); }
77 }
78 _ => {}
79 }
80 }
81 "IdentifiedObject.mRID" => {
82 match val {
83 crate::base::FieldValue::Text(sv) => { obj.base.base.base.m_rid = sv.clone(); }
84 crate::base::FieldValue::TextList(svs) => {
85 if let Some(sv) = svs.last() { obj.base.base.base.m_rid = sv.clone(); }
86 }
87 _ => {}
88 }
89 }
90 "IdentifiedObject.name" => {
91 match val {
92 crate::base::FieldValue::Text(sv) => { obj.base.base.base.name = sv.clone(); }
93 crate::base::FieldValue::TextList(svs) => {
94 if let Some(sv) = svs.last() { obj.base.base.base.name = sv.clone(); }
95 }
96 _ => {}
97 }
98 }
99 "IdentifiedObject.shortName" => {
100 match val {
101 crate::base::FieldValue::Text(sv) => { obj.base.base.base.short_name = sv.clone(); }
102 crate::base::FieldValue::TextList(svs) => {
103 if let Some(sv) = svs.last() { obj.base.base.base.short_name = sv.clone(); }
104 }
105 _ => {}
106 }
107 }
108 _ => {}
109 }
110 }
111 obj
112 }
113}