Skip to main content

DcSwitchingSimulator

Struct DcSwitchingSimulator 

Source
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: f64

Simulation time step (μs).

§duration_ms: f64

Total simulation duration (ms).

Implementations§

Source§

impl DcSwitchingSimulator

Source

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.
Source

pub fn add_station(&mut self, station: ConverterStation)

Add a converter station to the system.

Source

pub fn add_cable(&mut self, cable: DcCable)

Add a DC cable to the system.

Source

pub fn add_breaker(&mut self, breaker: DcBreaker)

Add a DC breaker to the system.

Source

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).

Source

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
Source

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)
Source

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.

Source

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

Source§

fn clone(&self) -> DcSwitchingSimulator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DcSwitchingSimulator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

unsafe fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.