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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marko Mecina
CCS
Commits
fd40e614
Commit
fd40e614
authored
Sep 23, 2023
by
Marko Mecina
Browse files
Options
Downloads
Patches
Plain Diff
update FEE HK CCD temperature conversion
parent
6be8105e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Ccs/calibrations_SMILE.py
+68
-20
68 additions, 20 deletions
Ccs/calibrations_SMILE.py
with
68 additions
and
20 deletions
Ccs/calibrations_SMILE.py
+
68
−
20
View file @
fd40e614
...
...
@@ -15,6 +15,12 @@ T_ZERO = 273.15
ADC_INPRNG
=
7.34783
# V
ADC_OFFSET
=
-
1.69565
# V
# FEE HK gains/offsets
FEE_CCD2TsA_gain
=
0.013772489
FEE_CCD2TsA_offset
=
542.131358
FEE_CCD4TsB_gain
=
0.013680992
FEE_CCD4TsB_offset
=
525.103894
class
Dpu
:
...
...
@@ -192,26 +198,6 @@ def t_ccd_deg_to_adu(t):
return
np
.
where
(
t
<=
_ccd_temp_adu_array
[
0
].
max
(),
t_ccd_deg_to_adu_oper
(
t
,
warn
=
False
),
t_ccd_deg_to_adu_nonoper
(
t
))
def
t_ccd_fee_adu_to_deg
(
adu
):
"""
For CCD temperature reported in FEE HK
:param adu:
:return:
"""
return
adu
/
65535
*
4.096
*
338.581
-
T_ZERO
def
t_ccd_fee_deg_to_adu
(
t
):
"""
For CCD temperature reported in FEE HK
:param t:
:return:
"""
return
np
.
rint
((
t
+
T_ZERO
)
/
(
4.096
*
338.581
)
*
65535
).
astype
(
int
)
def
t_temp1_adu_to_deg
(
adu
):
return
(
adu
*
ADC_INPRNG
/
(
2
**
14
-
1
)
+
ADC_OFFSET
-
V_T0
.
TEMP1
)
/
(
V_T0
.
TEMP1
*
K_T
.
TEMP1
)
...
...
@@ -535,6 +521,68 @@ SIGNAL_IASW_DBS = {
SIGNAL_DBS_IASW
=
{
SIGNAL_IASW_DBS
[
k
]:
k
for
k
in
SIGNAL_IASW_DBS
}
def
cal_pt1000
(
temp
):
"""
Standard DIN EN 60751 PT1000 transfer curve (-200 - 850°C)
:param temp: temperature in °C
:return: resistance in Ohm
"""
R0
=
1000
A
=
3.9083e-3
B
=
-
5.775e-7
C
=
-
4.183e-12
def
subzero
():
return
R0
*
(
1
+
A
*
temp
+
B
*
temp
**
2
+
C
*
(
temp
-
100
)
*
temp
**
3
)
def
abovezero
():
return
R0
*
(
1
+
A
*
temp
+
B
*
temp
**
2
)
if
(
np
.
array
(
temp
)
<
-
200
).
any
()
or
(
np
.
array
(
temp
)
>
850
).
any
():
print
(
"
WARNING: Value(s) outside calibrated range (-200 - 850°C)!
"
)
return
np
.
where
(
temp
>
0
,
abovezero
(),
subzero
())
_ptx
=
np
.
arange
(
-
200
,
851
)
_pty
=
cal_pt1000
(
_ptx
)
_pt1000_curve_inv
=
sp
.
interpolate
.
interp1d
(
_pty
,
_ptx
,
kind
=
'
cubic
'
,
fill_value
=
'
extrapolate
'
)
# inverse PT1000 curve for Ohm to °C conversion
def
t_ccd_fee_adu_to_deg
(
adu
,
ccd
):
"""
For CCD temperature reported in FEE HK
:param adu:
:param ccd:
:return:
"""
if
ccd
==
2
:
return
_pt1000_curve_inv
(
adu
*
FEE_CCD2TsA_gain
+
FEE_CCD2TsA_offset
)
elif
ccd
==
4
:
return
_pt1000_curve_inv
(
adu
*
FEE_CCD4TsB_gain
+
FEE_CCD4TsB_offset
)
else
:
raise
ValueError
(
"
CCD must be either 2 or 4!
"
)
def
t_ccd_fee_deg_to_adu
(
t
,
ccd
):
"""
For CCD temperature reported in FEE HK
:param t:
:param ccd:
:return:
"""
if
ccd
==
2
:
return
(
cal_pt1000
(
t
)
-
FEE_CCD2TsA_offset
)
/
FEE_CCD2TsA_gain
elif
ccd
==
4
:
return
(
cal_pt1000
(
t
)
-
FEE_CCD4TsB_offset
)
/
FEE_CCD4TsB_gain
else
:
raise
ValueError
(
"
CCD must be either 2 or 4!
"
)
if
__name__
==
'
__main__
'
:
import
matplotlib.pyplot
as
plt
...
...
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