surge_network/network/multi_section_line.rs
1// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0
2//! Multi-section line grouping data.
3//!
4//! A multi-section line is a transmission line modeled as multiple series
5//! sections with dummy (intermediate) buses. The grouping record identifies
6//! the terminal buses and the dummy buses that connect the sections.
7//! PSS/E RAW section: "MULTI-SECTION LINE DATA".
8
9use serde::{Deserialize, Serialize};
10
11/// A multi-section line grouping.
12///
13/// The individual line sections are stored as separate branches in
14/// `Network::branches`. This struct records the grouping metadata:
15/// which terminal buses the overall line connects, and which dummy
16/// buses are the internal section boundaries.
17#[derive(Debug, Clone, Serialize, Deserialize)]
18pub struct MultiSectionLineGroup {
19 /// From-bus number (I) — first terminal.
20 pub from_bus: u32,
21 /// To-bus number (J) — second terminal.
22 pub to_bus: u32,
23 /// Line identifier (ID).
24 pub id: String,
25 /// Metered end: 1 = from bus, 2 = to bus (MET).
26 pub metered_end: u32,
27 /// Dummy (intermediate) bus numbers connecting sections.
28 /// The actual line has `dummy_buses.len() + 1` sections.
29 pub dummy_buses: Vec<u32>,
30}
31
32impl Default for MultiSectionLineGroup {
33 fn default() -> Self {
34 Self {
35 from_bus: 0,
36 to_bus: 0,
37 id: "1".to_string(),
38 metered_end: 1,
39 dummy_buses: Vec::new(),
40 }
41 }
42}