pvlib-rust 0.1.6

A Rust port of pvlib-python: solar energy modeling toolkit
Documentation
/// **Note:** This is a simplified first-order smoothing approximation.
/// The full Wavelet Variability Model (Lave et al., 2013) requires
/// wavelet decomposition which is not yet implemented.
/// For production use, consider using the Python pvlib WVM implementation.
///
/// Simulated Wavelet Variability Model (WVM) smoothing.
///
/// Real WVM is mathematically complex. This provides a highly simplified
/// first-order low-pass filter representing the geographic smoothing of a PV plant footprint.
///
/// # Arguments
/// * `clear_sky_index` - The instantaneous ratio of measured GHI to clear sky GHI.
/// * `plant_area` - Total area of the PV plant scattered footprint in square meters.
/// * `cloud_speed` - Estimated cloud speed in m/s.
/// 
/// # Returns
/// A smoothed clear sky index representing geographic diversity array effects.
pub fn wvm_smoothing(clear_sky_index: f64, plant_area: f64, cloud_speed: f64) -> f64 {
    let transit_time = plant_area.sqrt() / cloud_speed.max(0.1);
    
    // Illustrative simplified transfer function. 
    // Larger area or slower clouds means more geographic smoothing
    let smoothing_factor = (1.0 - (-transit_time / 1000.0).exp()).clamp(0.0, 1.0);
    
    // Pushes the index closer to 1.0 (average variation)
    clear_sky_index + (1.0 - clear_sky_index) * (smoothing_factor * 0.5)
}