Exemple #1
0
 def get_state(self) -> Dict:
     return {
         "pledged_sell_kWh":
         convert_pendulum_to_str_in_dict(self.pledged_sell_kWh),
         "offered_sell_kWh":
         convert_pendulum_to_str_in_dict(self.offered_sell_kWh),
         "pledged_buy_kWh":
         convert_pendulum_to_str_in_dict(self.pledged_buy_kWh),
         "offered_buy_kWh":
         convert_pendulum_to_str_in_dict(self.offered_buy_kWh),
         "charge_history":
         convert_pendulum_to_str_in_dict(self.charge_history),
         "charge_history_kWh":
         convert_pendulum_to_str_in_dict(self.charge_history_kWh),
         "offered_history":
         convert_pendulum_to_str_in_dict(self.offered_history),
         "used_history":
         convert_pendulum_to_str_in_dict(self.used_history),
         "energy_to_buy_dict":
         convert_pendulum_to_str_in_dict(self.energy_to_buy_dict),
         "energy_to_sell_dict":
         convert_pendulum_to_str_in_dict(self.energy_to_sell_dict),
         "used_storage":
         self._used_storage,
         "battery_energy_per_slot":
         self._battery_energy_per_slot,
     }
 def generate_json_report(self):
     return {
         "job_id":
         self.job_id,
         "random_seed":
         self.random_seed,
         "unmatched_loads":
         convert_pendulum_to_str_in_dict(
             self.market_unmatched_loads.unmatched_loads, {}),
         "price_energy_day":
         convert_pendulum_to_str_in_dict(self.price_energy_day.csv_output,
                                         {}),
         "cumulative_grid_trades":
         self.cumulative_grid_trades.current_trades,
         "bills":
         self.market_bills.bills_results,
         "cumulative_bills":
         self.cumulative_bills.cumulative_bills,
         "status":
         self.status,
         "progress_info":
         self.simulation_progress,
         "device_statistics":
         convert_pendulum_to_str_in_dict(
             self.device_statistics.device_stats_dict, {}),
         "energy_trade_profile":
         convert_pendulum_to_str_in_dict(
             self.trade_profile.traded_energy_profile, {}, ui_format=True),
         "kpi":
         self.kpi.performance_indices,
         "area_throughput":
         self.area_throughput_stats.results,
     }
Exemple #3
0
 def get_state(self):
     return {
         "energy_rate":
         convert_pendulum_to_str_in_dict(self.energy_rate),
         "max_available_power_kW":
         convert_pendulum_to_str_in_dict(self.max_available_power_kW)
     }
Exemple #4
0
 def get_state(self):
     return {
         "rate_stats_market":
         convert_pendulum_to_str_in_dict(self.rate_stats_market),
         "exported_energy":
         convert_pendulum_to_str_in_dict(self.exported_traded_energy_kwh),
         "imported_energy":
         convert_pendulum_to_str_in_dict(self.imported_traded_energy_kwh),
     }
Exemple #5
0
def _convert_member_dt_to_string(in_dict):
    """
    Converts Datetime keys of members of in_dict into strings
    """
    for key, value in in_dict.items():
        if type(value) == dict:
            outdict = {}
            convert_pendulum_to_str_in_dict(value, outdict)
            in_dict[key] = outdict
    return in_dict
Exemple #6
0
    def get_state(self) -> Dict:
        """Return the current state of the device. Extends super implementation."""
        state = super().get_state()
        production_state = {
            "available_energy_kWh":
            convert_pendulum_to_str_in_dict(self._available_energy_kWh),
            "energy_production_forecast_kWh":
            convert_pendulum_to_str_in_dict(
                self._energy_production_forecast_kWh)
        }
        # The inherited state should not have keys with the same name (to avoid overwriting them)
        conflicting_keys = state.keys() & production_state.keys()
        assert not conflicting_keys, f"Conflicting state values found for {conflicting_keys}."

        state.update(production_state)
        return state
 def generate_result_report(self):
     # TODO: In D3ASIM-2288, add unix_time=True to convert_pendulum_to_str_in_dict
     return {
         "job_id":
         self.job_id,
         "current_market":
         self.current_market,
         "random_seed":
         self.random_seed,
         "cumulative_grid_trades":
         self.cumulative_grid_trades.current_trades,
         "bills":
         self.market_bills.bills_redis_results,
         "cumulative_bills":
         self.cumulative_bills.cumulative_bills,
         "status":
         self.status,
         "progress_info":
         self.simulation_progress,
         "kpi":
         self.kpi.performance_indices_redis,
         "last_unmatched_loads":
         convert_pendulum_to_str_in_dict(
             self.market_unmatched_loads.last_unmatched_loads, {}),
         "last_energy_trade_profile":
         convert_pendulum_to_str_in_dict(
             self.trade_profile.traded_energy_current, {}, ui_format=True),
         "last_price_energy_day":
         convert_pendulum_to_str_in_dict(self.price_energy_day.redis_output,
                                         {}),
         "last_device_statistics":
         convert_pendulum_to_str_in_dict(
             self.device_statistics.current_stats_dict, {}),
         "area_throughput":
         self.area_throughput_stats.results_redis,
         "last_energy_trades_high_resolution":
         convert_pendulum_to_str_in_dict(
             self.last_energy_trades_high_resolution, {}),
         "bids_offers_trades":
         self.bids_offers_trades,
         "results_area_uuids":
         list(self.result_area_uuids),
     }
Exemple #8
0
    def get_state(self) -> Dict:
        """Return the current state of the device. Extends super implementation."""
        state = super().get_state()
        consumption_state = {
            "desired_energy_Wh":
            convert_pendulum_to_str_in_dict(self._desired_energy_Wh),
            "total_energy_demanded_Wh":
            self._total_energy_demanded_Wh
        }
        # The inherited state should not have keys with the same name (to avoid overwriting them)
        conflicting_keys = state.keys() & consumption_state.keys()
        assert not conflicting_keys, f"Conflicting state values found for {conflicting_keys}."

        state.update(consumption_state)
        return state
Exemple #9
0
 def get_state(self):
     return {
         "energy_rate": convert_pendulum_to_str_in_dict(self.energy_rate),
         "energy_buy_rate": convert_pendulum_to_str_in_dict(self.energy_buy_rate),
     }
 def ui_formatted_results(self):
     return convert_pendulum_to_str_in_dict(self.redis_output, {})