Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Climate Lab Test Stand
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MSK-SW
Low-Level Radio Frequency
Climate Lab
Climate Lab Test Stand
Commits
488fe077
Commit
488fe077
authored
2 years ago
by
Sai Lakhan Ekal
Browse files
Options
Downloads
Patches
Plain Diff
Added internal function for simulated_humidity and use it in climate_chamber_dummy
parent
04f6d56f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Python_script/climate_chamber_dummy.py
+31
-7
31 additions, 7 deletions
Python_script/climate_chamber_dummy.py
with
31 additions
and
7 deletions
Python_script/climate_chamber_dummy.py
+
31
−
7
View file @
488fe077
...
...
@@ -27,8 +27,14 @@ class ClimateChamberDummy:
self
.
target_temperature
=
25
self
.
target_humidity
=
35
self
.
temperature_slope
=
0.1
# 0.1 degrees/second
self
.
humidity_slope
=
0.5
# degrees/second
def
_simulate_temp
(
self
):
def
simulation
(
self
):
self
.
simulate_temp
()
self
.
simulate_hum
()
self
.
last_simulation_time
=
self
.
virtual_time
.
time
()
def
simulate_temp
(
self
):
max_delta_temp
=
self
.
target_temperature
-
self
.
simulated_temperature
if
max_delta_temp
<
0
:
direction
=
-
1
...
...
@@ -44,24 +50,39 @@ class ClimateChamberDummy:
else
:
self
.
simulated_temperature
=
self
.
simulated_temperature
+
direction
*
self
.
temperature_slope
*
delta_time
self
.
last_simulation_time
=
new_time
def
simulate_hum
(
self
):
max_delta_hum
=
self
.
target_humidity
-
self
.
simulated_humidity
if
max_delta_hum
<
0
:
direction
=
-
1
else
:
direction
=
1
new_time
=
self
.
virtual_time
.
time
()
delta_time
=
new_time
-
self
.
last_simulation_time
max_hum_change_in_delta_time
=
self
.
humidity_slope
*
delta_time
if
abs
(
max_delta_hum
)
<
max_hum_change_in_delta_time
:
self
.
simulated_humidity
=
self
.
target_humidity
else
:
self
.
simulated_humidity
=
self
.
simulated_humidity
+
direction
*
self
.
humidity_slope
*
delta_time
# the communication section
def
read_temperature
(
self
):
self
.
_
simulat
e_temp
()
self
.
simulat
ion
()
# data format: [current temp, set temp, upper limit, lower limit]
return
[
self
.
simulated_temperature
,
self
.
target_temperature
,
0.
,
100.
]
def
read_humidity
(
self
):
if
self
.
simulated_humidity
<
self
.
target_humidity
:
self
.
simulated_humidity
+=
0.1
elif
self
.
simulated_humidity
>
self
.
target_humidity
:
self
.
simulated_humidity
-=
0.1
self
.
simulation
()
# data format: [current temp, set temp, upper limit, lower limit]
return
[
self
.
simulated_humidity
,
self
.
target_humidity
,
0.
,
100.
]
def
set_temperature
(
self
,
temperature
):
# simulate everything that has happened until now, before we store the new setpoint
self
.
simulation
()
# sets the temp of the chamber(float)
self
.
target_temperature
=
temperature
print
(
'
ChamberDummy: target temperature now is
'
+
str
(
self
.
target_temperature
))
...
...
@@ -69,6 +90,9 @@ class ClimateChamberDummy:
return
response
def
set_humidity
(
self
,
humidity
):
# simulate everything that has happened until now, before we store the new setpoint
self
.
simulation
()
# sets the humidity of the chamber(float)
self
.
target_humidity
=
humidity
print
(
'
ChamberDummy: target humidity now is
'
+
str
(
self
.
target_humidity
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment