Skip to main content

cimstructs/
BoundaryPoint.rs

1/// Designates a connection point at which one or more model authority sets shall connect to. The location of the connection point as well as other properties are agreed between organisations responsible for the interconnection, hence all attributes of the class represent this agreement. It is primarily used in a boundary model authority set which can contain one or many BoundaryPoint-s among other Equipment-s and their connections.
2#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct BoundaryPoint {
4    #[serde(flatten)]
5    pub base: super::PowerSystemResource,
6    /// The connectivity node that is designated as a boundary point.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub connectivity_node: Option<super::base::MridRef>,
9    /// The ISO code of the region which the 'From' side of the Boundary point belongs to or it is connected to. The ISO code is a two-character country code as defined by ISO 3166 (http://www.iso.org/iso/country_codes). The length of the string is 2 characters maximum.
10    pub from_end_iso_code: String,
11    /// A human readable name with length of the string 64 characters maximum. It covers the following two cases: -if the Boundary point is placed on a tie-line, it is the name (IdentifiedObject.name) of the substation at which the 'From' side of the tie-line is connected to. -if the Boundary point is placed in a substation, it is the name (IdentifiedObject.name) of the element (e.g. PowerTransformer, ACLineSegment, Switch, etc.) at which the 'From' side of the Boundary point is connected to.
12    pub from_end_name: String,
13    /// Identifies the name of the transmission system operator, distribution system operator or other entity at which the 'From' side of the interconnection is connected to. The length of the string is 64 characters maximum.
14    pub from_end_name_tso: String,
15    /// If true, this boundary point is a point of common coupling (PCC) of a direct current (DC) interconnection, otherwise the interconnection is AC (default).
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub is_direct_current: Option<bool>,
18    /// If true, this boundary point is on the interconnection that is excluded from control area interchange calculation and consequently has no related tie flows. Otherwise, the interconnection is included in control area interchange and a TieFlow is required at all sides of the boundary point (default).
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub is_excluded_from_area_interchange: Option<bool>,
21    /// The ISO code of the region which the 'To' side of the Boundary point belongs to or is connected to. The ISO code is a two-character country code as defined by ISO 3166 (http://www.iso.org/iso/country_codes). The length of the string is 2 characters maximum.
22    pub to_end_iso_code: String,
23    /// A human readable name with length of the string 64 characters maximum. It covers the following two cases: -if the Boundary point is placed on a tie-line, it is the name (IdentifiedObject.name) of the substation at which the 'To' side of the tie-line is connected to. -if the Boundary point is placed in a substation, it is the name (IdentifiedObject.name) of the element (e.g. PowerTransformer, ACLineSegment, Switch, etc.) at which the 'To' side of the Boundary point is connected to.
24    pub to_end_name: String,
25    /// Identifies the name of the transmission system operator, distribution system operator or other entity at which the 'To' side of the interconnection is connected to. The length of the string is 64 characters maximum.
26    pub to_end_name_tso: String,
27}
28impl crate::base::CimElement for BoundaryPoint {
29    fn mrid(&self) -> &str { &self.base.base.id }
30    fn type_name(&self) -> &'static str { "BoundaryPoint" }
31    fn as_any(&self) -> &dyn std::any::Any { self }
32    fn to_json_value(&self) -> serde_json::Value {
33        serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
34    }
35    fn to_block(&self) -> crate::base::RdfBlock {
36        let mut block = self.base.to_block();
37        block.type_name = "BoundaryPoint".to_string();
38        if let Some(ref v) = self.connectivity_node {
39            block.fields.insert("BoundaryPoint.ConnectivityNode".into(), crate::base::FieldValue::Resource(v.mrid.clone()));
40        }
41        if !self.from_end_iso_code.is_empty() {
42            block.fields.insert("BoundaryPoint.fromEndIsoCode".into(), crate::base::FieldValue::Text(self.from_end_iso_code.clone()));
43        }
44        if !self.from_end_name.is_empty() {
45            block.fields.insert("BoundaryPoint.fromEndName".into(), crate::base::FieldValue::Text(self.from_end_name.clone()));
46        }
47        if !self.from_end_name_tso.is_empty() {
48            block.fields.insert("BoundaryPoint.fromEndNameTso".into(), crate::base::FieldValue::Text(self.from_end_name_tso.clone()));
49        }
50        if let Some(v) = self.is_direct_current {
51            block.fields.insert("BoundaryPoint.isDirectCurrent".into(), crate::base::FieldValue::Text(v.to_string()));
52        }
53        if let Some(v) = self.is_excluded_from_area_interchange {
54            block.fields.insert("BoundaryPoint.isExcludedFromAreaInterchange".into(), crate::base::FieldValue::Text(v.to_string()));
55        }
56        if !self.to_end_iso_code.is_empty() {
57            block.fields.insert("BoundaryPoint.toEndIsoCode".into(), crate::base::FieldValue::Text(self.to_end_iso_code.clone()));
58        }
59        if !self.to_end_name.is_empty() {
60            block.fields.insert("BoundaryPoint.toEndName".into(), crate::base::FieldValue::Text(self.to_end_name.clone()));
61        }
62        if !self.to_end_name_tso.is_empty() {
63            block.fields.insert("BoundaryPoint.toEndNameTso".into(), crate::base::FieldValue::Text(self.to_end_name_tso.clone()));
64        }
65        block
66    }
67}
68
69impl BoundaryPoint {
70    pub fn from_block(b: &crate::base::RdfBlock) -> Self {
71        let mut obj = Self::default();
72        obj.base.base.id.clone_from(&b.mrid);
73        for (key, val) in &b.fields {
74            match key.as_str() {
75                "BoundaryPoint.ConnectivityNode" => {
76                    if let crate::base::FieldValue::Resource(sv) = val {
77                        obj.connectivity_node = Some(crate::base::MridRef { mrid: sv.clone() });
78                    }
79                }
80                "BoundaryPoint.fromEndIsoCode" => {
81                    match val {
82                        crate::base::FieldValue::Text(sv) => { obj.from_end_iso_code = sv.clone(); }
83                        crate::base::FieldValue::TextList(svs) => {
84                            if let Some(sv) = svs.last() { obj.from_end_iso_code = sv.clone(); }
85                        }
86                        _ => {}
87                    }
88                }
89                "BoundaryPoint.fromEndName" => {
90                    match val {
91                        crate::base::FieldValue::Text(sv) => { obj.from_end_name = sv.clone(); }
92                        crate::base::FieldValue::TextList(svs) => {
93                            if let Some(sv) = svs.last() { obj.from_end_name = sv.clone(); }
94                        }
95                        _ => {}
96                    }
97                }
98                "BoundaryPoint.fromEndNameTso" => {
99                    match val {
100                        crate::base::FieldValue::Text(sv) => { obj.from_end_name_tso = sv.clone(); }
101                        crate::base::FieldValue::TextList(svs) => {
102                            if let Some(sv) = svs.last() { obj.from_end_name_tso = sv.clone(); }
103                        }
104                        _ => {}
105                    }
106                }
107                "BoundaryPoint.isDirectCurrent" => {
108                    match val {
109                        crate::base::FieldValue::Text(sv) => { obj.is_direct_current = Some(sv.trim() == "true"); }
110                        crate::base::FieldValue::TextList(svs) => {
111                            if let Some(sv) = svs.last() { obj.is_direct_current = Some(sv.trim() == "true"); }
112                        }
113                        _ => {}
114                    }
115                }
116                "BoundaryPoint.isExcludedFromAreaInterchange" => {
117                    match val {
118                        crate::base::FieldValue::Text(sv) => { obj.is_excluded_from_area_interchange = Some(sv.trim() == "true"); }
119                        crate::base::FieldValue::TextList(svs) => {
120                            if let Some(sv) = svs.last() { obj.is_excluded_from_area_interchange = Some(sv.trim() == "true"); }
121                        }
122                        _ => {}
123                    }
124                }
125                "BoundaryPoint.toEndIsoCode" => {
126                    match val {
127                        crate::base::FieldValue::Text(sv) => { obj.to_end_iso_code = sv.clone(); }
128                        crate::base::FieldValue::TextList(svs) => {
129                            if let Some(sv) = svs.last() { obj.to_end_iso_code = sv.clone(); }
130                        }
131                        _ => {}
132                    }
133                }
134                "BoundaryPoint.toEndName" => {
135                    match val {
136                        crate::base::FieldValue::Text(sv) => { obj.to_end_name = sv.clone(); }
137                        crate::base::FieldValue::TextList(svs) => {
138                            if let Some(sv) = svs.last() { obj.to_end_name = sv.clone(); }
139                        }
140                        _ => {}
141                    }
142                }
143                "BoundaryPoint.toEndNameTso" => {
144                    match val {
145                        crate::base::FieldValue::Text(sv) => { obj.to_end_name_tso = sv.clone(); }
146                        crate::base::FieldValue::TextList(svs) => {
147                            if let Some(sv) = svs.last() { obj.to_end_name_tso = sv.clone(); }
148                        }
149                        _ => {}
150                    }
151                }
152                "IdentifiedObject.description" => {
153                    match val {
154                        crate::base::FieldValue::Text(sv) => { obj.base.base.description = sv.clone(); }
155                        crate::base::FieldValue::TextList(svs) => {
156                            if let Some(sv) = svs.last() { obj.base.base.description = sv.clone(); }
157                        }
158                        _ => {}
159                    }
160                }
161                "IdentifiedObject.energyIdentCodeEic" => {
162                    match val {
163                        crate::base::FieldValue::Text(sv) => { obj.base.base.energy_ident_code_eic = sv.clone(); }
164                        crate::base::FieldValue::TextList(svs) => {
165                            if let Some(sv) = svs.last() { obj.base.base.energy_ident_code_eic = sv.clone(); }
166                        }
167                        _ => {}
168                    }
169                }
170                "IdentifiedObject.mRID" => {
171                    match val {
172                        crate::base::FieldValue::Text(sv) => { obj.base.base.m_rid = sv.clone(); }
173                        crate::base::FieldValue::TextList(svs) => {
174                            if let Some(sv) = svs.last() { obj.base.base.m_rid = sv.clone(); }
175                        }
176                        _ => {}
177                    }
178                }
179                "IdentifiedObject.name" => {
180                    match val {
181                        crate::base::FieldValue::Text(sv) => { obj.base.base.name = sv.clone(); }
182                        crate::base::FieldValue::TextList(svs) => {
183                            if let Some(sv) = svs.last() { obj.base.base.name = sv.clone(); }
184                        }
185                        _ => {}
186                    }
187                }
188                "IdentifiedObject.shortName" => {
189                    match val {
190                        crate::base::FieldValue::Text(sv) => { obj.base.base.short_name = sv.clone(); }
191                        crate::base::FieldValue::TextList(svs) => {
192                            if let Some(sv) = svs.last() { obj.base.base.short_name = sv.clone(); }
193                        }
194                        _ => {}
195                    }
196                }
197                _ => {}
198            }
199        }
200        obj
201    }
202}