@@ -343,7 +343,7 @@ def action_map(self, action_map: Union[List[Mapping[str, Mapping[int, float]]],
343343
344344 for n in action_names :
345345 action_map [n ] = {}
346-
346+
347347 if 'storage' in n :
348348 for hour in Building .get_periodic_observation_metadata ()['hour' ]:
349349 if 6 <= hour <= 14 :
@@ -387,100 +387,4 @@ def action_map(self, action_map: Union[List[Mapping[str, Mapping[int, float]]],
387387 else :
388388 raise ValueError (f'Unknown action name: { n } ' )
389389
390- HourRBC .action_map .fset (self , action_map )
391-
392- class BasicElectricVehicleRBC_ReferenceController (BasicRBC ): #change the name
393- r"""A rule-based controller that charges EVs to the maximum of the chargers and to the maximum of the battery upon connection.
394-
395- The EV battery is charged at the maximum available charging power whenever it is connected.
396-
397- Parameters
398- ----------
399- env: CityLearnEnv
400- CityLearn environment.
401-
402- Other Parameters
403- ----------------
404- **kwargs: Any
405- Other keyword arguments used to initialize super class.
406- """
407-
408- def __init__ (self , env : CityLearnEnv , ** kwargs : Any ):
409- super ().__init__ (env , ** kwargs )
410-
411- @HourRBC .action_map .setter
412- def action_map (self , action_map : Union [
413- List [Mapping [str , Mapping [int , float ]]], Mapping [str , Mapping [int , float ]], Mapping [int , float ]]):
414- if action_map is None :
415- action_map = {}
416- action_names = [a_ for a in self .action_names for a_ in a ]
417- action_names = list (set (action_names ))
418-
419- for n in action_names :
420- action_map [n ] = {}
421-
422- if n == "electrical_storage" :
423- for hour in Building .get_periodic_observation_metadata ()['hour' ]:
424- if 9 <= hour <= 21 :
425- value = - 0.08
426- elif (1 <= hour <= 8 ) or (22 <= hour <= 24 ):
427- value = 0.091
428- else :
429- value = 0.0
430-
431- action_map [n ][hour ] = value
432-
433- elif n == 'cooling_device' :
434- for hour in Building .get_periodic_observation_metadata ()['hour' ]:
435- if 9 <= hour <= 21 :
436- value = 0.8
437- elif (1 <= hour <= 8 ) or (22 <= hour <= 24 ):
438- value = 0.4
439- else :
440- value = 0.0
441-
442- action_map [n ][hour ] = value
443-
444- elif n == 'heating_device' :
445- for hour in Building .get_periodic_observation_metadata ()['hour' ]:
446- if 9 <= hour <= 21 :
447- value = 0.4
448- elif (1 <= hour <= 8 ) or (22 <= hour <= 24 ):
449- value = 0.8
450- else :
451- value = 0.0
452-
453- action_map [n ][hour ] = value
454-
455- elif n == 'cooling_or_heating_device' :
456- for hour in Building .get_periodic_observation_metadata ()['hour' ]:
457- if hour < 7 :
458- value = 0.4
459-
460- elif hour < 21 :
461- value = - 0.4
462-
463- else :
464- value = 0.8
465-
466- action_map [n ][hour ] = value
467-
468- elif "electric_vehicle" in n :
469- for hour in Building .get_periodic_observation_metadata ()['hour' ]:
470- value = 1
471- action_map [n ][hour ] = value
472-
473- elif "dhw_storage" in n :
474- for hour in Building .get_periodic_observation_metadata ()['hour' ]:
475- value = 1
476- action_map [n ][hour ] = value
477-
478- elif "washing_machine" in n :
479- for hour in Building .get_periodic_observation_metadata ()['hour' ]:
480- value = 1
481- action_map [n ][hour ] = value
482-
483- else :
484- raise ValueError (f'Unknown action name: { n } ' )
485-
486- HourRBC .action_map .fset (self , action_map )
390+ HourRBC .action_map .fset (self , action_map )
0 commit comments