EvCharger

Struct EvCharger 

Source
pub struct EvCharger {
    pub max_charge_kw: f32,
    pub steps_per_day: usize,
    pub demand_kwh_min: f32,
    pub demand_kwh_max: f32,
    pub dwell_steps_min: usize,
    pub dwell_steps_max: usize,
    sampled_day: Option<usize>,
    session: Option<EvSession>,
    rng: StdRng,
}
Expand description

A flexible electric load model using EV-style charging sessions.

Each simulated day, this model samples one charging session with:

  • random arrival time
  • random dwell duration (which sets deadline)
  • random required energy in kWh

During an active session, charging power is computed as the minimum required to meet the remaining energy by the deadline, limited by max_charge_kw.

Fields§

§max_charge_kw: f32

Maximum charging power in kilowatts.

§steps_per_day: usize

Number of simulation steps per day.

§demand_kwh_min: f32

Minimum daily charging demand in kWh.

§demand_kwh_max: f32

Maximum daily charging demand in kWh.

§dwell_steps_min: usize

Minimum connected duration in simulation steps.

§dwell_steps_max: usize

Maximum connected duration in simulation steps.

§sampled_day: Option<usize>§session: Option<EvSession>§rng: StdRng

Implementations§

Source§

impl EvCharger

Source

pub fn new( max_charge_kw: f32, steps_per_day: usize, demand_kwh_min: f32, demand_kwh_max: f32, dwell_steps_min: usize, dwell_steps_max: usize, seed: u64, ) -> Self

Source

fn dt_hours(&self) -> f32

Source

fn sample_session_for_day(&mut self, day: usize)

Source

pub fn requested_power_kw(&mut self, context: &DeviceContext) -> f32

Returns the unconstrained charging request at the current timestep.

Trait Implementations§

Source§

impl Debug for EvCharger

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Device for EvCharger

Source§

fn power_kw(&mut self, context: &DeviceContext) -> f32

Returns the power value at the specified time step. Read more
Source§

fn device_type(&self) -> &'static str

Returns a human-readable type name for the device.

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