Skip to main content

surge_network/network/
owner.rs

1// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0
2//! Owner data.
3//!
4//! An owner is a named entity (utility, company) that owns equipment in the
5//! network. PSS/E devices (generators, branches, loads) carry owner numbers.
6//! PSS/E RAW section: "OWNER DATA".
7
8use serde::{Deserialize, Serialize};
9
10/// A named owner of power system equipment.
11///
12/// The owner number is referenced by generators, branches, loads, and other
13/// devices. This struct provides the name lookup table.
14#[derive(Debug, Clone, Serialize, Deserialize)]
15pub struct Owner {
16    /// Owner number (OWNUM in PSS/E).
17    pub number: u32,
18    /// Owner name, up to 12 characters (OWNAME in PSS/E).
19    pub name: String,
20}
21
22/// A single (owner_number, fraction) pair from PSS/E multi-owner records.
23///
24/// Generators, branches, and transformers support up to 4 co-owners with
25/// fractional ownership. Buses and loads carry a single entry (fraction = 1.0).
26#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
27pub struct OwnershipEntry {
28    /// Owner number, referencing an entry in `Network.owners`.
29    pub owner: u32,
30    /// Fractional ownership (0.0..=1.0). Defaults to 1.0 for single-owner devices.
31    pub fraction: f64,
32}
33
34impl Default for Owner {
35    fn default() -> Self {
36        Self {
37            number: 1,
38            name: String::new(),
39        }
40    }
41}