def __init__(self, agent_obj, passenger_obj, is_terminal=False): ''' Args: agent_obj (OOMDPObject) passenger_obj (OOMDPObject): Assuming single passenger domain for now is_terminal (bool) ''' self.agent_obj = agent_obj self.passenger_obj = passenger_obj OOMDPState.__init__(self, { 'agent': [agent_obj], 'passenger': [passenger_obj] }, is_terminal=is_terminal)
def tmy_step_to_OOMDP(current_step_data, tracker, solpos, old_tilt, albedo): ''' Creates OOMDP state from TMY data. ''' #time since epoch in sec last_unix = current_step_data.index.view('int64') #time of day hour = current_step_data.index.hour sun_attributes = {'apparent_zenith': float(solpos['apparent_zenith']), 'azimuth': float(solpos['azimuth'])} env_attributes = {'DHI': float(current_step_data['DHI']), 'GHI': float(current_step_data['GHI']), 'DNI':float(current_step_data['DNI']), 'Wspd':float(current_step_data['Wspd']), 'DryBulb': float(current_step_data['DryBulb']), 'TotCld':float(current_step_data['TotCld']), 'OpqCld':float(current_step_data['OpqCld']), 'albedo':albedo, 'datetime':last_unix, 'hour':hour} angle_pos = pvlib.tracking.singleaxis(solpos['apparent_zenith'], solpos['azimuth'], backtrack=False) surface_tilt = angle_pos['tracker_theta'] # print(surface_tilt) if np.isnan(surface_tilt[0]): #TODO: fix this wrt hour surface_tilt = tracker.fallback_angle if hour > 12 else -tracker.fallback_angle tracker_attributes = {'tracker_theta':surface_tilt, 'prev_angle':old_tilt} sun_obj = OOMDPObject(sun_attributes, name="sun") env_obj = OOMDPObject(env_attributes, name="env") tracker_obj = OOMDPObject(tracker_attributes, name="tracker") #passing list of objects for class! objects = {'sun':[sun_obj], 'env':[env_obj], 'tracker':[tracker_obj]} return OOMDPState(objects)
def __init__(self, objects, date_time, longitude, latitude, sun_angle_AZ, sun_angle_ALT, clouds=[]): self.date_time = date_time self.longitude = longitude self.latitude = latitude self.sun_angle_AZ = sun_angle_AZ self.sun_angle_ALT = sun_angle_ALT # Hm. self.clouds = clouds OOMDPState.__init__(self, objects=objects)
class ArduinoOOMDPState(OOMDPState): ''' Class for Arduino solar panel states. Contains the sun position, the current angle of the single-axis tracker, and the image recieved by the camera. The image and panel angles are represented as objects ''' def __init__(self, objects, date_time, longitude, latitude, sun_angle_AZ, sun_angle_ALT): self.date_time = date_time self.longitude = longitude self.latitude = latitude self.sun_angle_AZ = sun_angle_AZ self.sun_angle_ALT = sun_angle_ALT OOMDPState.__init__(self, objects=objects)
def __init__(self, objects): OOMDPState.__init__(self, objects=objects)