Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Calibration
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Calibration
Commits
2ced12d3
Commit
2ced12d3
authored
Sep 05, 2017
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
track fiber spool temperature option
parent
f8fb4902
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
3 deletions
+55
-3
wr_serial.py
sw/insitu_alpha/wr_serial.py
+55
-3
No files found.
sw/insitu_alpha/wr_serial.py
View file @
2ced12d3
...
...
@@ -30,6 +30,7 @@ Options:
-h --help Show this screen.
-sm master serial port, default: "/dev/ttyUSB2"
-ss slave serial port, default: "/dev/ttyUSB1"
-t track fiber spool temperature (using Digital Multimeter and PT100), default: False
-o <dir> optional directory for output file storage, default: "data/"
-m <number> number of measurement cycles (default = 1 cyle is a sweep from
start to stop lambda)
...
...
@@ -241,7 +242,38 @@ def get_statusline(ser_slave):
stat_lst
=
stat
.
split
(
' '
)
# split on spaces
return
(
stat_lst
)
############################################################################
def
pt_100
(
ohm
):
"""
Calculates the temperature for a given measured PT-100 resistance.
ohm -- Ohmic value of the PT-100
"""
# Rt = R0.(1 + A.t + B.t^2 + C.(t-100).t^3)
R0
=
float
(
100.0
)
A
=
float
(
3.9083e-3
)
B
=
float
(
-
5.7750e-7
)
# C = -4,1430e-12 for t < 0 degrees / 0.0 for t >= 0 degrees
# For C = 0 =>
temp
=
(
-
R0
*
A
+
(
R0
**
2
*
A
**
2
-
4
*
R0
*
B
*
(
R0
-
ohm
))
**
0.5
)
/
(
2
*
R0
*
B
)
return
(
temp
)
############################################################################
def
get_spool_temp
(
dmm
):
"""
Read the fiber spool temperature with the Digital Multimeter
"""
ohm
=
float
(
dmm
.
ask
(
"READ?"
))
return
(
pt_100
(
ohm
))
###############################################
# Main
###############################################
...
...
@@ -255,6 +287,7 @@ Options:
-h --help Show this screen.
-sm master serial port, default: "/dev/ttyUSB2"
-ss slave serial port, default: "/dev/ttyUSB1"
-t <IP> track fiber spool temperature (using PT100 and Digital Multimeter at IP address)
-o <dir> optional directory for output file storage, default: "data/"
-m <number> number of measurement cycles (default = 1 cyle is a sweep from
start to stop lambda)
...
...
@@ -268,11 +301,13 @@ if __name__ == "__main__":
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"-mserial"
,
default
=
"/dev/ttyUSB2"
)
parser
.
add_argument
(
"-sserial"
,
default
=
"/dev/ttyUSB1"
)
parser
.
add_argument
(
"-t"
,
help
=
"track fiber spool temperature (using PT100 and Digital Multimeter at IP address)"
,
default
=
None
)
parser
.
add_argument
(
"-output_dir"
,
default
=
"data"
)
parser
.
add_argument
(
"-measurements"
,
default
=
1
,
type
=
int
)
args
=
parser
.
parse_args
()
print
(
"Use Master Serial port: "
,
args
.
mserial
)
print
(
"Use Slave Serial port: "
,
args
.
sserial
)
print
(
"Fiber spool temperature track: "
,
args
.
t
)
print
(
"Output directory: "
,
args
.
output_dir
)
print
(
"Number of measuremnt cycles: "
,
args
.
measurements
)
...
...
@@ -308,6 +343,19 @@ if __name__ == "__main__":
crtt_skip
=
2
# skip first 5 crtt measurments
restarts
=
1
# number of link restarts over which the crtt is averaged
spool_temp
=
None
# if not used then default None
if
args
.
t
!=
None
:
# open and configue Digital Multimeter with attached PT100
import
vxi11
dmm
=
vxi11
.
Instrument
(
args
.
t
)
print
(
dmm
.
ask
(
"*IDN?"
))
# Returns 'Keysight Technologies,34465A,MY57501367,A.02.14-02.40-02.14-00.49-03-01'
# Configure for 4 wire resistance range 100 ohm
dmm
.
write
(
"CONFigure:FRESistance 100"
)
dmm
.
write
(
"SAMPle:COUNt 1"
)
#print("Fiber Spool temperature", get_spool_temp(dmm))
ser_slave
=
serial
.
Serial
()
ser_slave
.
port
=
args
.
sserial
...
...
@@ -373,7 +421,7 @@ if __name__ == "__main__":
data_file
.
write
(
"#In Situ Alpha measurements
\n
"
)
data_file
.
write
(
"#date:"
+
time
.
strftime
(
format
(
"
%
d
%
b
%
Y"
),
timestamp
)
+
"
\n
"
)
data_file
.
write
(
"#time:"
+
time
.
strftime
(
format
(
"
%
H:
%
M:
%
S"
),
timestamp
)
+
"
\n
"
)
data_file
.
write
(
"#sfp_channel, ITU channel, ITU wavelength, crtt [ps], drxm, drxs,
temperature
\n
"
)
data_file
.
write
(
"#sfp_channel, ITU channel, ITU wavelength, crtt [ps], drxm, drxs,
fiber-spool-temp, wr-slave-temp
\n
"
)
# scan through selected wavelengths
for
ch
in
numpy
.
arange
(
itu_channel_start
,
itu_channel_stop
+
0.5
,
itu_channel_increment
):
...
...
@@ -459,8 +507,12 @@ if __name__ == "__main__":
if
not
failed
:
crtt_mean
=
numpy
.
mean
(
crtt
[(
crtt_skip
+
1
):])
# skip first measurements
print
(
"sfp_channel: "
,
sfp_ch
,
"itu_channel: "
,
ch
,
"crtt avarage over "
+
str
(
crtt_measurement
)
+
" measurments: "
+
str
(
crtt_mean
))
data_file
.
write
(
str
(
sfp_ch
)
+
", "
+
str
(
ch
)
+
", "
+
str
(
wavelength
)
+
", "
+
str
(
crtt_mean
)
+
", "
+
str
(
curr_drxm
)
+
", "
+
str
(
curr_drxs
)
+
", "
+
str
(
curr_temp
)
+
"
\n
"
)
if
args
.
t
!=
None
:
# open and configue Digital Multimeter with attached PT100
spool_temp
=
get_spool_temp
(
dmm
)
print
(
"sfp_channel: "
,
sfp_ch
,
"itu_channel: "
,
ch
,
"crtt avarage over "
+
str
(
crtt_measurement
)
+
" measurments: "
+
str
(
crtt_mean
)
+
" fiber-spool temp: "
+
str
(
spool_temp
))
data_file
.
write
(
str
(
sfp_ch
)
+
", "
+
str
(
ch
)
+
", "
+
str
(
wavelength
)
+
", "
+
str
(
crtt_mean
)
+
", "
+
str
(
curr_drxm
)
+
", "
+
str
(
curr_drxs
)
+
", "
+
str
(
spool_temp
)
+
", "
+
str
(
curr_temp
)
+
"
\n
"
)
except
:
print
(
"### exception during crtt_measurements."
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment