Skip to main content

SolarCell

Struct SolarCell 

Source
pub struct SolarCell {
    pub i_ph: f64,
    pub i_0: f64,
    pub n_ideal: f64,
    pub temperature: f64,
    pub r_series: f64,
}
Expand description

Simple single-diode solar cell model.

Computes the current–voltage (I–V) characteristic of an ideal single-diode solar cell using the Shockley equation:

I = I_ph - I_0 * (exp(q*V/(n*k*T)) - 1)

where I_ph is the photocurrent and I_0 is the dark saturation current.

Fields§

§i_ph: f64

Photocurrent [A]

§i_0: f64

Dark saturation current [A]

§n_ideal: f64

Ideality factor (1 for ideal)

§temperature: f64

Temperature [K]

§r_series: f64

Series resistance [Ω]

Implementations§

Source§

impl SolarCell

Source

pub fn new( i_ph: f64, i_0: f64, n_ideal: f64, temperature: f64, r_series: f64, ) -> Self

Create a new solar cell model.

Source

pub fn thermal_voltage(&self) -> f64

Thermal voltage [V]: V_t = k*T/q.

Source

pub fn short_circuit_current(&self) -> f64

Short-circuit current [A] (at V = 0): I_sc ≈ I_ph.

Source

pub fn current_at_voltage(&self, v: f64) -> f64

Current [A] at terminal voltage v [V].

Neglects series resistance for simplicity (direct explicit form).

Source

pub fn power_at_voltage(&self, v: f64) -> f64

Power [W] at terminal voltage v [V].

Source

pub fn open_circuit_voltage(&self) -> f64

Open-circuit voltage [V]: solved numerically (bisection).

At V_oc: I = 0 → I_ph = I_0*(exp(V_oc/(n*V_t)) - 1). Exact: V_oc = n*V_t * ln(I_ph/I_0 + 1).

Source

pub fn fill_factor(&self) -> f64

Fill factor (FF): FF = P_max / (I_sc * V_oc).

Estimated using the empirical Green formula: FF ≈ (v_oc - ln(v_oc + 0.72)) / (v_oc + 1) where v_oc = V_oc / V_t (normalised open-circuit voltage).

Source

pub fn efficiency(&self, irradiance: f64, area: f64) -> f64

Efficiency: η = P_max / P_in where P_max = FF * I_sc * V_oc.

§Arguments
  • irradiance — incident irradiance [W/m²]
  • area — cell area [m²]

Trait Implementations§

Source§

impl Clone for SolarCell

Source§

fn clone(&self) -> SolarCell

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SolarCell

Source§

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

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

impl Copy for SolarCell

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