示例#1
0
    def resource_df(self, **kwargs):
        """
        Preview of the optimisation. Return

        :return:
        """
        route = tuple(self.route.flatten())
        return simulation.power_unit_area(self.start_time, route, self.speed,
                                          **kwargs)
示例#2
0
def temporal_optimization(
    start_time,
    route,
    speed,
    solar_area,
    wind_area,
    use,
    battery_capacity,
    depth_of_discharge=1,
    discharge_rate=0.005,
    battery_eff=0.9,
    discharge_eff=0.8,
    title=0,
    azim=0,
    tracking=0,
    power_coefficient=0.26,
    cut_in_speed=2,
    cut_off_speed=15,
    technology='csi',
    system_loss=0.10,
    angles=None,
    dataFrame=False,
    trace_back=False,
    pandas=False,
):
    """
    Simulation based optimization for

    :param start_time: str or Dataindex start date of journey
    :param route: numpy nd array (n,2) [lat, lon] of way points
    :param speed: float or list if float is given, it is assumed as constant speed operation mode
                otherwise, a list of n with averaged speed should be given
    :param wind_area: float area of wind turbine area
    :param solar_area: float m^2 area of solar panel area
    :param use: float m^2 load demand of the system
    :param battery_capacity: float Wh total battery capacity of the renewable energy system
    :param title: float degrees title angle of PV panel
    :param azim: float degrees azim angle of PV panel
    :param tracking: int 0 1 or 2 0 for no tracking, 1 for one axis, 2 for two axis
    :param power_coefficient: float power coefficient of wind turbine
    :param cut_in_speed: float m/s cut in speed of wind turbine
    :param cut_off_speed: float m/s cut off speed of wind turbine
    :param technology: optional str 'csi'
    :param system_loss: float system lost of the system
    :param angles: optional solar angle
    :param dataFrame: optional return dataframe or not
    :param trace_back: optional in True give all trace back
    :return: float lost power supply probability (LPSP)
    if trace_back option is on then gives LPSP, SOC, energy history, unmet energy history, water history
    """
    # Pack route to immutable object for caching
    route = tuple(route.flatten())
    solar_power_unit, wind_power_unit = simulation.power_unit_area(
        start_time,
        route,
        speed,
        title=title,
        azim=azim,
        tracking=tracking,
        power_coefficient=power_coefficient,
        cut_in_speed=cut_in_speed,
        cut_off_speed=cut_off_speed,
        technology=technology,
        system_loss=system_loss,
        angles=angles,
        dataFrame=dataFrame,
    )
    solar_power = solar_power_unit * solar_area
    wind_power = wind_power_unit * wind_area
    power = solar_power + wind_power
    SOC, energy_history, unmet_history, waste_history, use_history = soc_model_fixed_load(
        power,
        use,
        battery_capacity,
        depth_of_discharge,
        discharge_rate,
        battery_eff,
        discharge_eff,
    )
    LPSP = 1 - unmet_history.count(0) / len(energy_history)
    if trace_back:
        if pandas:
            all_history = np.vstack((
                np.array(power.tolist()),
                np.array(waste_history),
                np.array(energy_history),
                np.array(use_history),
                np.array(unmet_history),
                np.array(solar_power),
                np.array(wind_power),
            ))
            sim_df = pd.DataFrame(
                all_history.T,
                index=power.index,
                columns=[
                    'Power',
                    'Waste',
                    'Battery',
                    'Use',
                    'Unmet',
                    'Solar_power',
                    'Wind_power',
                ],
            )
            return sim_df, LPSP
        else:
            return (
                LPSP,
                SOC,
                energy_history,
                unmet_history,
                waste_history,
                use_history,
                power,
            )
    else:
        return LPSP