Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CCS
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marko Mecina
CCS
Commits
b66711ac
Commit
b66711ac
authored
1 year ago
by
Marko Mecina
Browse files
Options
Downloads
Patches
Plain Diff
update SXI thermal model & control
parent
21eaf172
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Ccs/thermal_control.py
+14
-8
14 additions, 8 deletions
Ccs/thermal_control.py
Ccs/thermal_model.py
+4
-1
4 additions, 1 deletion
Ccs/thermal_model.py
with
18 additions
and
9 deletions
Ccs/thermal_control.py
+
14
−
8
View file @
b66711ac
...
...
@@ -19,7 +19,7 @@ class ThermalController:
VCTRLUPPERVOLT
=
2.8
MAXDELTAVOLTAGE
=
0.2
def
__init__
(
self
,
temp_ref
,
coeffP
,
coeffI
,
offset
,
exec_per
,
model
=
None
):
def
__init__
(
self
,
temp_ref
,
coeffP
,
coeffI
,
offset
,
exec_per
,
model
=
None
,
pi
=
True
,
deltaTmax
=
1.
):
self
.
tempRef
=
temp_ref
self
.
coeffP
=
coeffP
...
...
@@ -37,6 +37,13 @@ class ThermalController:
self
.
hctrl_par_exec_per
=
exec_per
self
.
_algo_active
=
False
if
pi
:
self
.
calc_vctrl
=
self
.
do_pi_vctrl
else
:
self
.
calc_vctrl
=
self
.
on_off_vctrl
self
.
deltaTmax
=
deltaTmax
self
.
model
=
model
self
.
log
=
[]
...
...
@@ -45,7 +52,7 @@ class ThermalController:
def
set_temp_ref
(
self
,
temp
):
self
.
tempRef
=
temp
def
calculate
_vctrl
(
self
,
temp
):
def
do_pi
_vctrl
(
self
,
temp
):
deltaTime
=
self
.
hctrl_par_exec_per
*
self
.
ASW_PERIOD_MS
/
1000
integ
=
self
.
integOld
+
deltaTime
*
(
self
.
tempRef
-
self
.
tempOld
)
...
...
@@ -69,11 +76,11 @@ class ThermalController:
self
.
voltCtrlUint16
=
vctrl_ana_to_dig
(
self
.
voltCtrl
)
def
on_off_vctrl
(
self
,
temp
,
deltaTmax
=
1.
):
def
on_off_vctrl
(
self
,
temp
):
if
temp
>
self
.
tempRef
+
deltaTmax
:
if
temp
>
self
.
tempRef
+
self
.
deltaTmax
:
v
=
self
.
voltCtrl
-
self
.
MAXDELTAVOLTAGE
elif
temp
<
self
.
tempRef
-
deltaTmax
:
elif
temp
<
self
.
tempRef
-
self
.
deltaTmax
:
v
=
self
.
voltCtrl
+
self
.
MAXDELTAVOLTAGE
else
:
v
=
self
.
voltCtrl
...
...
@@ -121,14 +128,13 @@ class ThermalController:
def
_step
(
self
,
t1
,
with_model
=
True
,
glitch
=
0
):
if
with_model
:
self
.
temp
=
self
.
model
.
T_noisy
+
glitch
self
.
calculate_vctrl
(
self
.
temp
)
# self.on_off_vctrl(self.temp)
self
.
calc_vctrl
(
self
.
temp
)
self
.
model
.
set_heater_power
(
vctrl
=
self
.
voltCtrl
)
self
.
log
.
append
((
t1
,
self
.
tempRef
,
self
.
temp
,
self
.
voltCtrl
,
self
.
coeffI
*
self
.
integOld
,
self
.
coeffP
*
(
self
.
tempRef
-
self
.
temp
)))
else
:
self
.
calc
ulate
_vctrl
(
self
.
temp
)
self
.
calc_vctrl
(
self
.
temp
)
def
stop_algo
(
self
):
self
.
_algo_active
=
False
...
...
This diff is collapsed.
Click to expand it.
Ccs/thermal_model.py
+
4
−
1
View file @
b66711ac
...
...
@@ -140,6 +140,8 @@ class ThermalModel:
self
.
htr_pwr
=
0
self
.
htr_cur
=
0
self
.
inst_heat
=
0
# additional, immediate heat input (e.g., from CCD, etc.)
self
.
_evolving
=
False
self
.
record
=
record
self
.
log
=
[]
...
...
@@ -179,7 +181,8 @@ class ThermalModel:
def
heat
(
self
):
self
.
heat_pipe
+=
self
.
htr_pwr
*
self
.
heat_distr
addheat
=
self
.
heat_pipe
[
0
]
addheat
=
self
.
heat_pipe
[
0
]
+
self
.
inst_heat
#print(self.heat_pipe, self.heat_pipe.sum(), self.htr_pwr,self.inst_heat)
self
.
heat_pipe
=
np
.
roll
(
self
.
heat_pipe
,
-
1
)
self
.
heat_pipe
[
-
1
]
=
0
return
addheat
...
...
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