Beispiel #1
0
def get_mission(start_time, route, speed):
    """
    Calculate position dataFrame at given start time, route and speed

    :param start_time: str or Pandas Timestamp, the str input should have format YYYY-MM-DD close the day
    :param route: numpy array shape (n,2)  list of way points formatted as [lat, lon]
    :param speed: int, float or (n) list, speed of platform unit in km/h
    :return: Pandas dataFrame
    """
    if type(start_time) == str:
        start_time = pd.Timestamp(start_time)

    position_df = full_day_cut(position_dataframe(start_time, route, speed))
    return position_df
Beispiel #2
0
    def post_run(self, solar_area, wind_area, battery_capacity, dispatch):
        print('====== Post simulation run ======')
        power_supply = (
            self.wind_power_simulation * wind_area
            + self.solar_power_simulation * solar_area
        )

        post_run_len = len(dispatch)  # match length of simulation
        supply, load = power_supply[:post_run_len].tolist(), dispatch['Power'].tolist()

        if self.config != {}:
            battery = Battery(battery_capacity, config=self.config)
        else:
            battery = Battery(battery_capacity)

        battery.run(supply, load)
        prop_load = (self.Task.load_demand - self.Task.hotel_load).values
        load_demand = self.Task.load_demand.values
        hotel_load = self.Task.hotel_load.values
        critical_load = self.Task.critical_prop_load + self.Task.critical_hotel_load.values

        load_demand_history = np.vstack((load_demand, prop_load, hotel_load, critical_load))
        load_demand_history_df = pd.DataFrame(
            data=load_demand_history.T,
            index=self.Task.mission.df.index,
            columns=['Load_demand', 'Prop_load', 'Hotel_load', 'Critical_load'],
        )

        load_demand_history_df = full_day_cut(load_demand_history_df)

        battery_history = battery.battery_history()
        battery_history_df = pd.DataFrame(
            data=battery_history[:post_run_len].T,
            index=self.df[:post_run_len].index,
            columns=['SOC', 'Battery', 'Unmet', 'Waste', 'Supply'],
        )

        results = [
            battery_history_df,
            load_demand_history_df[:post_run_len],
            self.solar[:post_run_len] * solar_area,
            self.wind[:post_run_len] * wind_area,
        ]
        result_df = pd.concat(results, axis=1)

        return result_df
Beispiel #3
0
    def post_run(self, solar_area, wind_area, battery_capacity, dispatch):
        power_supply = (self.wind_power_simulation * wind_area +
                        self.solar_power_simulation * solar_area)

        post_run_len = len(dispatch)  # match length of simulation
        supply, load = power_supply[:post_run_len].tolist(
        ), dispatch['Power'].tolist()

        if self.config != {}:
            model = Soc_model_variable_load(
                Battery(battery_capacity, config=self.config), supply, load)
        else:
            model = Soc_model_variable_load(Battery(battery_capacity), supply,
                                            load)

        prop_load = (self.Task.load_demand[:post_run_len] -
                     self.Task.hotel_load[:post_run_len]).as_matrix()
        load_demand = self.Task.load_demand[:post_run_len].as_matrix()
        hotel_load = self.Task.hotel_load[:post_run_len].as_matrix()

        load_demand_history = np.vstack((load_demand, prop_load, hotel_load))
        load_demand_history_df = pd.DataFrame(
            data=load_demand_history[:post_run_len].T,
            index=self.Task.mission.df[:post_run_len].index,
            columns=['Load_demand', 'Prop_load', 'Hotel_load'],
        )

        load_demand_history_df = full_day_cut(load_demand_history_df)

        battery_history = model.get_battery_history()
        battery_history_df = pd.DataFrame(
            data=battery_history[:post_run_len].T,
            index=self.df[:post_run_len].index,
            columns=['SOC', 'Battery', 'Unmet', 'Waste', 'Supply'],
        )

        results = [
            battery_history_df,
            load_demand_history_df[:post_run_len],
            self.solar[:post_run_len] * solar_area,
            self.wind[:post_run_len] * wind_area,
        ]
        result_df = pd.concat(results, axis=1)

        return result_df
Beispiel #4
0
    def result(self, solar_area, wind_area, battery_capacity):
        power_supply = (self.wind_power_simulation * wind_area +
                        self.solar_power_simulation * solar_area)
        supply, load = power_supply.tolist(), self.Task.load_demand.tolist()
        if self.config is not {}:
            model = Soc_model_variable_load(
                Battery(battery_capacity, config=self.config), supply, load)
        else:
            model = Soc_model_variable_load(Battery(battery_capacity), supply,
                                            load)

        prop_load = (self.Task.load_demand - self.Task.hotel_load).as_matrix()
        load_demand = self.Task.load_demand.as_matrix()
        hotel_load = self.Task.hotel_load.as_matrix()

        load_demand_history = np.vstack((load_demand, prop_load, hotel_load))
        load_demand_history_df = pd.DataFrame(
            data=load_demand_history.T,
            index=self.Task.mission.df.index,
            columns=['Load_demand', 'Prop_load', 'Hotel_load'],
        )
        load_demand_history_df = full_day_cut(load_demand_history_df)

        battery_history = model.get_battery_history()
        battery_history_df = pd.DataFrame(
            data=battery_history.T,
            index=self.df.index,
            columns=['SOC', 'Battery', 'Unmet', 'Waste', 'Supply'],
        )

        results = [
            battery_history_df,
            load_demand_history_df,
            self.solar * solar_area,
            self.wind * wind_area,
        ]
        result_df = pd.concat(results, axis=1)
        return result_df
Beispiel #5
0
 def __init__(self, mission):
     self.mission = full_day_cut(mission.df)
     self.resource_df = None
     self.solar_power = 0
     self.wind_power = 0
     self.battery_energy = 0