Skip to content
Snippets Groups Projects
Commit c8c1d5dc authored by Martin Killenberg's avatar Martin Killenberg
Browse files

introduce communication delays for more realisitc simulation

parent a75b31a0
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,7 @@ class VnaDummy:
self.reference_temp = 25
self.magnitude_slope = 0.2
self.phase_slope = 0.1
self.communication_delay = 0.2
def run_simulation(self):
self.simulate_magnitude()
......@@ -104,6 +105,8 @@ class VnaDummy:
measurment_string = ' '
for i in range(50):
measurment_string += str(real_val) + ',' + str(imaginary_val) + ','
# doing the measurement and reading out some time
self.simulated_state.simulated_time += self.communication_delay
# removed last comma by adding slicing([:-1])
return measurment_string[:-1]
......
......@@ -28,6 +28,7 @@ class ClimateChamberDummy:
self.target_humidity = 35
self.temperature_slope = 0.1 # 0.1 degrees/second
self.humidity_slope = 0.5 # degrees/second
self.communication_delay = 0.3
def run_simulation(self):
self.simulate_temp()
......@@ -72,11 +73,13 @@ class ClimateChamberDummy:
def read_temperature(self):
self.simulated_state.simulated_time += self.communication_delay
# data format: [current temp, set temp, upper limit, lower limit]
return [self.simulated_state.simulated_temperature, self.target_temperature, 0., 100.]
def read_humidity(self):
self.simulated_state.simulated_time += self.communication_delay
# data format: [current temp, set temp, upper limit, lower limit]
return [self.simulated_state.simulated_humidity, self.target_humidity, 0., 100.]
......@@ -86,6 +89,7 @@ class ClimateChamberDummy:
self.target_temperature = temperature
print('ChamberDummy: target temperature now is ' + str(self.target_temperature))
response = 'OK: TEMP, S30\r\n'
self.simulated_state.simulated_time += self.communication_delay
return response
def set_humidity(self, humidity):
......@@ -95,6 +99,7 @@ class ClimateChamberDummy:
self.target_humidity = humidity
print('ChamberDummy: target humidity now is ' + str(self.target_humidity))
response = 'OK: HUMI, S30\r\n'
self.simulated_state.simulated_time += self.communication_delay
return response
def close(self):
......@@ -105,6 +110,7 @@ class ClimateChamberDummy:
def set_mode(self, mode):
self.simulated_mode = mode
response = 'FIXME!!!'
self.simulated_state.simulated_time += self.communication_delay
return response
def get_const(self):
......@@ -133,6 +139,7 @@ class ClimateChamberDummy:
self.set_humidity(setPoint[1])
def read_mode(self):
self.simulated_state.simulated_time += self.communication_delay
return self.simulated_mode
# deprecated. Use read_humidity etc. instead
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment