pub struct ModelChain {
pub system: PVSystem,
pub location: Location,
pub surface_tilt: f64,
pub surface_azimuth: f64,
pub inverter_pac0: f64,
pub inverter_eta: f64,
pub config: ModelChainConfig,
}Expand description
Orchestrates the full PV system performance simulation pipeline.
Fields§
§system: PVSystem§location: Location§surface_tilt: f64§surface_azimuth: f64§inverter_pac0: f64§inverter_eta: f64§config: ModelChainConfigImplementations§
Source§impl ModelChain
impl ModelChain
Sourcepub fn new(
system: PVSystem,
location: Location,
surface_tilt: f64,
surface_azimuth: f64,
inverter_pac0: f64,
inverter_eta: f64,
) -> Self
pub fn new( system: PVSystem, location: Location, surface_tilt: f64, surface_azimuth: f64, inverter_pac0: f64, inverter_eta: f64, ) -> Self
Create a new ModelChain with explicit parameters (legacy constructor).
Sourcepub fn with_config(
system: PVSystem,
location: Location,
surface_tilt: f64,
surface_azimuth: f64,
inverter_pac0: f64,
inverter_eta: f64,
config: ModelChainConfig,
) -> Self
pub fn with_config( system: PVSystem, location: Location, surface_tilt: f64, surface_azimuth: f64, inverter_pac0: f64, inverter_eta: f64, config: ModelChainConfig, ) -> Self
Create a ModelChain with a custom configuration.
Sourcepub fn with_pvwatts(
system: PVSystem,
location: Location,
surface_tilt: f64,
surface_azimuth: f64,
inverter_pac0: f64,
inverter_eta: f64,
) -> Self
pub fn with_pvwatts( system: PVSystem, location: Location, surface_tilt: f64, surface_azimuth: f64, inverter_pac0: f64, inverter_eta: f64, ) -> Self
Factory: PVWatts-style configuration.
Uses PVWatts DC/AC, Physical AOI, PVWatts temperature, Perez transposition.
Sourcepub fn with_sapm(
system: PVSystem,
location: Location,
surface_tilt: f64,
surface_azimuth: f64,
inverter_pac0: f64,
inverter_eta: f64,
) -> Self
pub fn with_sapm( system: PVSystem, location: Location, surface_tilt: f64, surface_azimuth: f64, inverter_pac0: f64, inverter_eta: f64, ) -> Self
Factory: SAPM-style configuration.
Uses PVWatts DC, PVWatts AC, ASHRAE AOI, SAPM temperature, HayDavies transposition.
Sourcepub fn run_model(
&self,
time: DateTime<Tz>,
_ghi: f64,
dni: f64,
dhi: f64,
temp_air: f64,
_wind_speed: f64,
) -> Result<SimulationResult, SpaError>
pub fn run_model( &self, time: DateTime<Tz>, _ghi: f64, dni: f64, dhi: f64, temp_air: f64, _wind_speed: f64, ) -> Result<SimulationResult, SpaError>
Run the model for a single timestep with given weather data (legacy API).
Sourcepub fn run_model_from_weather(
&self,
weather: &WeatherInput,
) -> Result<ModelChainResult, SpaError>
pub fn run_model_from_weather( &self, weather: &WeatherInput, ) -> Result<ModelChainResult, SpaError>
Run the full simulation pipeline from weather data.
Steps: solar position -> airmass -> AOI -> transposition -> AOI modifier -> spectral modifier -> effective irradiance -> cell temperature -> DC power -> AC power.
Sourcepub fn run_model_from_poa(
&self,
input: &POAInput,
) -> Result<ModelChainResult, SpaError>
pub fn run_model_from_poa( &self, input: &POAInput, ) -> Result<ModelChainResult, SpaError>
Run the simulation starting from plane-of-array irradiance data.
Skips transposition step but still computes solar position for airmass.
Sourcepub fn run_model_from_effective_irradiance(
&self,
input: &EffectiveIrradianceInput,
) -> Result<ModelChainResult, SpaError>
pub fn run_model_from_effective_irradiance( &self, input: &EffectiveIrradianceInput, ) -> Result<ModelChainResult, SpaError>
Run the simulation starting from effective irradiance.
Skips solar position, transposition, AOI, and spectral steps.
Sourcepub fn complete_irradiance(
&self,
weather: &WeatherInput,
) -> Result<(f64, f64, f64), SpaError>
pub fn complete_irradiance( &self, weather: &WeatherInput, ) -> Result<(f64, f64, f64), SpaError>
Fill missing GHI, DNI, or DHI using the Erbs decomposition model.
If all three are provided, returns them as-is. If GHI is provided but DNI or DHI are missing, uses Erbs to decompose. If GHI is missing but DNI and DHI are provided, computes GHI = DNI * cos(zenith) + DHI.