diff --git a/Python_script/external_sensors.py b/Python_script/external_sensors.py index 6a46c15cce95e1530b5833bc9cb30271b02b9286..b73b0a43e6c42b40c2fd1cc674e5537f8d753f74 100644 --- a/Python_script/external_sensors.py +++ b/Python_script/external_sensors.py @@ -2,6 +2,32 @@ from almemo710 import almemo710 from almemo2490 import almemo2490 import pandas as pd +import climate_chamber_dummy + + +class ExternalSensorsDummy: + def __init__(self): + self.climate_chamber_dummy = climate_chamber_dummy.get_climate_chamber_dummy([0.2, 0.1]) + + def get_sensor_values(self): + # FIXME: Do we have to run the simulation here or do we piggy-back on the chamber probably also being dummy? + temp = self.climate_chamber_dummy.read_temperature()[0] + humidity = self.climate_chamber_dummy.read_humidity()[0] + # half a degree thermal cycle of 10 minutes from the room's air conditioning + room_temp = 22.97 + abs((self.climate_chamber_dummy.last_simulation_time % 600)-300)/600 + # Use the same DUT chamber values as the simulation, but constant measurement instrument chamber and room + # temp_dut, temp_room, temp_meas_instr, hum_dut, hum_room, hum_meas_instr, air_press_room + return temp, room_temp, 23.0, humidity, 62.2, 45.0, 1013 + + def close(self): + pass + + +def create_sensors(logger_model, logger_address, ext_sensor_channels): + if logger_address == 'localhost': + return ExternalSensorsDummy() + else: + return ExternalSensors(logger_model, logger_address, ext_sensor_channels) class ExternalSensors: diff --git a/Python_script/prototype.py b/Python_script/prototype.py index 5419ee660ee7dc749523dcd51df0eefc1ab3f9be..305b8875099a7b422ebd2cd6ed701e311d45dac1 100755 --- a/Python_script/prototype.py +++ b/Python_script/prototype.py @@ -75,8 +75,8 @@ class Measurements: self.vna = VNA.create_vna(vna_address, target_accuracy) # data logger for external sensors - self.ext_sensors = external_sensors.ExternalSensors(config_data['logger_model'], logger_address, - ext_sensor_channels) + self.ext_sensors = external_sensors.create_sensors(config_data['logger_model'], logger_address, + ext_sensor_channels) self.standby = standby self.output_basename = output_basename