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: f64Photocurrent [A]
i_0: f64Dark saturation current [A]
n_ideal: f64Ideality factor (1 for ideal)
temperature: f64Temperature [K]
r_series: f64Series resistance [Ω]
Implementations§
Source§impl SolarCell
impl SolarCell
Sourcepub fn new(
i_ph: f64,
i_0: f64,
n_ideal: f64,
temperature: f64,
r_series: f64,
) -> Self
pub fn new( i_ph: f64, i_0: f64, n_ideal: f64, temperature: f64, r_series: f64, ) -> Self
Create a new solar cell model.
Sourcepub fn thermal_voltage(&self) -> f64
pub fn thermal_voltage(&self) -> f64
Thermal voltage [V]: V_t = k*T/q.
Sourcepub fn short_circuit_current(&self) -> f64
pub fn short_circuit_current(&self) -> f64
Short-circuit current [A] (at V = 0): I_sc ≈ I_ph.
Sourcepub fn current_at_voltage(&self, v: f64) -> f64
pub fn current_at_voltage(&self, v: f64) -> f64
Current [A] at terminal voltage v [V].
Neglects series resistance for simplicity (direct explicit form).
Sourcepub fn power_at_voltage(&self, v: f64) -> f64
pub fn power_at_voltage(&self, v: f64) -> f64
Power [W] at terminal voltage v [V].
Sourcepub fn open_circuit_voltage(&self) -> f64
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).
Sourcepub fn fill_factor(&self) -> f64
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).