pub struct DcSwitchingSimulator {
pub stations: Vec<ConverterStation>,
pub cables: Vec<DcCable>,
pub breakers: Vec<DcBreaker>,
pub dt_us: f64,
pub duration_ms: f64,
}Expand description
DC switching transient simulator for multi-terminal HVDC grids.
§Example
use oxigrid::network::dc_switching::*;
let mut sim = DcSwitchingSimulator::new(10.0, 100.0);
sim.add_station(ConverterStation {
id: 0,
name: "Rectifier".to_string(),
topology: ConverterTopology::Lcc,
v_dc_rated_kv: 500.0,
p_rated_mw: 1000.0,
x_transformer_pu: 0.15,
scr: 3.0,
control_angle_deg: 15.0,
x_commutation_pu: 0.1,
arm_inductance_mh: 0.0,
sm_capacitance_uf: 0.0,
});Fields§
§stations: Vec<ConverterStation>Converter stations.
cables: Vec<DcCable>DC cables connecting stations.
breakers: Vec<DcBreaker>DC circuit breakers.
dt_us: f64Simulation time step (μs).
duration_ms: f64Total simulation duration (ms).
Implementations§
Source§impl DcSwitchingSimulator
impl DcSwitchingSimulator
Sourcepub fn new(dt_us: f64, duration_ms: f64) -> Self
pub fn new(dt_us: f64, duration_ms: f64) -> Self
Create a new simulator with the given time step and duration.
§Arguments
dt_us— Integration time step in microseconds.duration_ms— Total simulation duration in milliseconds.
Sourcepub fn add_station(&mut self, station: ConverterStation)
pub fn add_station(&mut self, station: ConverterStation)
Add a converter station to the system.
Sourcepub fn add_breaker(&mut self, breaker: DcBreaker)
pub fn add_breaker(&mut self, breaker: DcBreaker)
Add a DC breaker to the system.
Sourcepub fn solve_dc_power_flow(&self) -> Result<DcGridSolution, String>
pub fn solve_dc_power_flow(&self) -> Result<DcGridSolution, String>
Solve the DC grid power flow using Newton’s method.
Computes steady-state voltages, currents, and losses across the multi-terminal DC grid. The first station is treated as the voltage reference (slack bus).
Sourcepub fn lcc_operating_point(
&self,
station: &ConverterStation,
i_dc_ka: f64,
) -> ConverterOperatingPoint
pub fn lcc_operating_point( &self, station: &ConverterStation, i_dc_ka: f64, ) -> ConverterOperatingPoint
Compute LCC converter operating point.
Uses the standard LCC equations:
V_dc = (3√2/π) · V_ac · cos(α) − (3/π) · X_c · I_dc- Power factor ≈ cos(α) · (1 − μ/2)
- Losses = 0.7% × P_rated + I_dc² × R_converter
Sourcepub fn vsc_operating_point(
&self,
station: &ConverterStation,
p_mw: f64,
v_dc_kv: f64,
) -> ConverterOperatingPoint
pub fn vsc_operating_point( &self, station: &ConverterStation, p_mw: f64, v_dc_kv: f64, ) -> ConverterOperatingPoint
Compute VSC converter operating point.
Uses VSC equations:
V_dc = V_ac · m · √(3/2)where m = modulation index- Independent P/Q control capability
- Losses = a + b·I + c·I² (switching + conduction)
Sourcepub fn simulate_fault(
&self,
fault: &DcFaultEvent,
) -> Result<DcTransientResult, String>
pub fn simulate_fault( &self, fault: &DcFaultEvent, ) -> Result<DcTransientResult, String>
Simulate a DC fault event and return the transient result.
Models the fault as an RLC circuit with parameters derived from the faulted cable and connected converter stations. Uses RK4 integration for the state-space model.
Sourcepub fn simulate_switching(
&self,
breaker_id: usize,
open: bool,
) -> Result<DcTransientResult, String>
pub fn simulate_switching( &self, breaker_id: usize, open: bool, ) -> Result<DcTransientResult, String>
Simulate a switching transient (breaker open/close).
Models the voltage/current transients that occur when a breaker is opened or closed, including LC oscillations from cable capacitance.
Trait Implementations§
Source§impl Clone for DcSwitchingSimulator
impl Clone for DcSwitchingSimulator
Source§fn clone(&self) -> DcSwitchingSimulator
fn clone(&self) -> DcSwitchingSimulator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DcSwitchingSimulator
impl RefUnwindSafe for DcSwitchingSimulator
impl Send for DcSwitchingSimulator
impl Sync for DcSwitchingSimulator
impl Unpin for DcSwitchingSimulator
impl UnsafeUnpin for DcSwitchingSimulator
impl UnwindSafe for DcSwitchingSimulator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.