Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ess-public-screens
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
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
Code review analytics
Issue 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
ics-software
ess-public-screens
Commits
dd82e9f1
Commit
dd82e9f1
authored
4 years ago
by
Emanuele Laface
Browse files
Options
Downloads
Patches
Plain Diff
New TS2 Screen with Archiver data
parent
7f717610
No related branches found
No related tags found
No related merge requests found
Pipeline
#39012
failed
4 years ago
Stage: check
Stage: build
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
PythonServer/screens/ts2_screens.py
+40
-13
40 additions, 13 deletions
PythonServer/screens/ts2_screens.py
WebSites/pvs/dashboard.json
+1
-1
1 addition, 1 deletion
WebSites/pvs/dashboard.json
WebSites/ts2_screens/dashboard.json
+44
-38
44 additions, 38 deletions
WebSites/ts2_screens/dashboard.json
with
85 additions
and
52 deletions
PythonServer/screens/ts2_screens.py
+
40
−
13
View file @
dd82e9f1
...
@@ -2,6 +2,9 @@ import epics
...
@@ -2,6 +2,9 @@ import epics
import
json
import
json
import
time
import
time
import
sys
import
sys
import
pandas
import
requests
import
datetime
from
threading
import
Thread
from
threading
import
Thread
...
@@ -16,7 +19,7 @@ class ts2_screensScreen(Thread):
...
@@ -16,7 +19,7 @@ class ts2_screensScreen(Thread):
"
TS2-010CDL:Cryo-TE-82313:MeasValue
"
,
"
TS2-010CDL:Cryo-TE-82313:MeasValue
"
,
"
TS2-010CDL:Cryo-TE-82360:MeasValue
"
,
"
TS2-010CDL:Cryo-TE-82360:MeasValue
"
,
"
TS2-010CRM:Cryo-TE-068:MeasValue
"
,
"
TS2-010CRM:Cryo-TE-068:MeasValue
"
,
"
TS2-010CRM:Cryo-TE-063:MeasValue
"
,
#
"TS2-010CRM:Cryo-TE-063:MeasValue",
"
TS2-010CRM:Cryo-TE-069:MeasValue
"
,
"
TS2-010CRM:Cryo-TE-069:MeasValue
"
,
"
TS2-010CRM:Cryo-TE-064:MeasValue
"
,
"
TS2-010CRM:Cryo-TE-064:MeasValue
"
,
"
TS2-010CDL:Cryo-TE-82365:MeasValue
"
,
"
TS2-010CDL:Cryo-TE-82365:MeasValue
"
,
...
@@ -28,23 +31,46 @@ class ts2_screensScreen(Thread):
...
@@ -28,23 +31,46 @@ class ts2_screensScreen(Thread):
for
pv
in
pvs
:
for
pv
in
pvs
:
epics_dict
[
pv
]
=
epics
.
PV
(
pv
,
auto_monitor
=
True
)
epics_dict
[
pv
]
=
epics
.
PV
(
pv
,
auto_monitor
=
True
)
counter
=
0
while
not
self
.
stop_signal
.
isSet
():
while
not
self
.
stop_signal
.
isSet
():
try
:
try
:
json_dict
=
{}
if
counter
%
7200
==
0
:
json_dict
=
{}
for
pv
in
epics_dict
:
start_date
=
(
datetime
.
datetime
.
now
()
-
datetime
.
timedelta
(
days
=
14
)).
isoformat
()
+
'
Z
'
end_date
=
datetime
.
datetime
.
now
().
isoformat
()
+
'
Z
'
url
=
'
http://archiver-01.tn.esss.lu.se:17668/retrieval/data/getData.json?pv=count({})&from={}&to={}
'
.
format
(
pv
,
start_date
,
end_date
)
r
=
requests
.
get
(
url
).
json
()[
0
][
'
data
'
]
entries
=
0
for
i
in
r
:
entries
+=
i
[
'
val
'
]
url
=
'
http://archiver-01.tn.esss.lu.se:17668/retrieval/data/getData.json?pv=nth_{}({})&from={}&to={}
'
.
format
(
int
(
entries
//
1400
),
pv
,
start_date
,
end_date
)
r
=
requests
.
get
(
url
).
json
()[
0
][
'
data
'
]
raw_data
=
pandas
.
DataFrame
.
from_dict
(
r
)
final_data
=
{}
final_data
[
'
2w
'
]
=
raw_data
.
groupby
(
raw_data
.
index
//
(
raw_data
.
shape
[
0
]
/
100
)).
mean
()
tmp
=
raw_data
[
raw_data
[
'
secs
'
]
>
(
datetime
.
datetime
.
now
()
-
datetime
.
timedelta
(
days
=
7
)).
timestamp
()]
final_data
[
'
1w
'
]
=
tmp
.
groupby
(
tmp
.
index
//
(
tmp
.
shape
[
0
]
/
100
)).
mean
()
tmp
=
raw_data
[
raw_data
[
'
secs
'
]
>
(
datetime
.
datetime
.
now
()
-
datetime
.
timedelta
(
days
=
2
)).
timestamp
()]
final_data
[
'
2d
'
]
=
tmp
.
groupby
(
tmp
.
index
//
(
tmp
.
shape
[
0
]
/
100
)).
mean
()
tmp
=
raw_data
[
raw_data
[
'
secs
'
]
>
(
datetime
.
datetime
.
now
()
-
datetime
.
timedelta
(
days
=
1
)).
timestamp
()]
final_data
[
'
1d
'
]
=
tmp
.
groupby
(
tmp
.
index
//
(
tmp
.
shape
[
0
]
/
100
)).
mean
()
final_data
[
'
live
'
]
=
raw_data
[
-
100
:]
json_dict
[
pv
]
=
{}
json_dict
[
pv
][
'
2w
'
]
=
list
(
zip
((
final_data
[
'
2w
'
][
'
secs
'
]
*
1000
).
astype
(
'
int
'
)
+
(
final_data
[
'
2w
'
][
'
nanos
'
]
/
1e6
).
astype
(
'
int
'
),
round
(
final_data
[
'
2w
'
][
'
val
'
],
3
)))
json_dict
[
pv
][
'
1w
'
]
=
list
(
zip
((
final_data
[
'
1w
'
][
'
secs
'
]
*
1000
).
astype
(
'
int
'
)
+
(
final_data
[
'
1w
'
][
'
nanos
'
]
/
1e6
).
astype
(
'
int
'
),
round
(
final_data
[
'
1w
'
][
'
val
'
],
3
)))
json_dict
[
pv
][
'
2d
'
]
=
list
(
zip
((
final_data
[
'
2d
'
][
'
secs
'
]
*
1000
).
astype
(
'
int
'
)
+
(
final_data
[
'
2d
'
][
'
nanos
'
]
/
1e6
).
astype
(
'
int
'
),
round
(
final_data
[
'
2d
'
][
'
val
'
],
3
)))
json_dict
[
pv
][
'
1d
'
]
=
list
(
zip
((
final_data
[
'
1d
'
][
'
secs
'
]
*
1000
).
astype
(
'
int
'
)
+
(
final_data
[
'
1d
'
][
'
nanos
'
]
/
1e6
).
astype
(
'
int
'
),
round
(
final_data
[
'
1d
'
][
'
val
'
],
3
)))
json_dict
[
pv
][
'
live
'
]
=
list
(
zip
((
final_data
[
'
live
'
][
'
secs
'
]
*
1000
).
astype
(
'
int
'
)
+
(
final_data
[
'
live
'
][
'
nanos
'
]
/
1e6
).
astype
(
'
int
'
),
round
(
final_data
[
'
live
'
][
'
val
'
],
3
)))
counter
=
0
for
pv
in
epics_dict
:
for
pv
in
epics_dict
:
json_dict
[
pv
]
=
{}
if
epics_dict
[
pv
].
connected
:
if
epics_dict
[
pv
].
connected
:
json_dict
[
pv
][
"
units
"
]
=
epics_dict
[
pv
].
units
json_dict
[
pv
][
"
timestamp
"
]
=
epics_dict
[
pv
].
timestamp
value
=
epics_dict
[
pv
].
value
value
=
epics_dict
[
pv
].
value
if
type
(
value
)
==
float
:
timestamp
=
int
(
epics_dict
[
pv
].
timestamp
*
1000
)
json_dict
[
pv
][
"
value
"
]
=
round
(
value
,
3
)
if
type
(
value
)
==
float
and
timestamp
!=
json_dict
[
pv
][
'
live
'
][
-
1
][
0
]:
else
:
json_dict
[
pv
][
'
live
'
]
=
json_dict
[
pv
][
'
live
'
][
1
:]
json_dict
[
pv
][
"
value
"
]
=
value
json_dict
[
pv
][
'
live
'
].
append
((
timestamp
,
round
(
value
,
3
)))
else
:
json_dict
[
pv
][
"
units
"
]
=
"
n.c.
"
json_dict
[
pv
][
"
timestamp
"
]
=
""
json_dict
[
pv
][
"
value
"
]
=
""
tmp_json
=
json
.
dumps
(
json_dict
)
tmp_json
=
json
.
dumps
(
json_dict
)
tmp_json
=
tmp_json
.
replace
(
"
NaN
"
,
"
0
"
)
tmp_json
=
tmp_json
.
replace
(
"
NaN
"
,
"
0
"
)
...
@@ -55,6 +81,7 @@ class ts2_screensScreen(Thread):
...
@@ -55,6 +81,7 @@ class ts2_screensScreen(Thread):
print
(
sys
.
exc_info
())
print
(
sys
.
exc_info
())
time
.
sleep
(
1
)
time
.
sleep
(
1
)
time
.
sleep
(
0.5
)
time
.
sleep
(
0.5
)
counter
+=
1
for
pv
in
epics_dict
:
for
pv
in
epics_dict
:
epics_dict
[
pv
].
clear_auto_monitor
()
epics_dict
[
pv
].
clear_auto_monitor
()
...
...
This diff is collapsed.
Click to expand it.
WebSites/pvs/dashboard.json
+
1
−
1
View file @
dd82e9f1
...
@@ -202,4 +202,4 @@
...
@@ -202,4 +202,4 @@
}
}
],
],
"columns"
:
4
"columns"
:
4
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
WebSites/ts2_screens/dashboard.json
+
44
−
38
View file @
dd82e9f1
...
@@ -4,6 +4,26 @@
...
@@ -4,6 +4,26 @@
"allow_edit"
:
false
,
"allow_edit"
:
false
,
"plugins"
:
[],
"plugins"
:
[],
"panes"
:
[
"panes"
:
[
{
"title"
:
"Time Selector"
,
"width"
:
1
,
"row"
:
{
"3"
:
7
},
"col"
:
{
"3"
:
1
},
"col_width"
:
4
,
"widgets"
:
[
{
"type"
:
"html"
,
"settings"
:
{
"html"
:
"<script>
\n
function setDatasource(event) {
\n\t\t
freeboard.showLoadingIndicator(true);
\n\t
};
\n
</script>
\n
<div style=
\"
position:relative;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;
\"
>
\n
<select onchange=
\"
setDatasource()
\"
id=
\"
time-series
\"
>
\n
<option value=
\"
2w
\"
>Two Weeks</option>
\n
<option value=
\"
1w
\"
>One Week</option>
\n
<option value=
\"
2d
\"
>Two Days</option>
\n
<option value=
\"
1d
\"
>One Day</option>
\n
<option value=
\"
live
\"
>Live</option>
\n
</select>
\n
</div>"
,
"height"
:
1
}
}
]
},
{
{
"width"
:
1
,
"width"
:
1
,
"row"
:
{
"row"
:
{
...
@@ -35,7 +55,7 @@
...
@@ -35,7 +55,7 @@
"row"
:
{
"row"
:
{
"1"
:
7
,
"1"
:
7
,
"2"
:
7
,
"2"
:
7
,
"3"
:
7
,
"3"
:
11
,
"4"
:
7
,
"4"
:
7
,
"5"
:
39
,
"5"
:
39
,
"6"
:
39
,
"6"
:
39
,
...
@@ -53,51 +73,37 @@
...
@@ -53,51 +73,37 @@
"col_width"
:
4
,
"col_width"
:
4
,
"widgets"
:
[
"widgets"
:
[
{
{
"type"
:
"
highcharts-timeseries
"
,
"type"
:
"
flot_extended_plugin
"
,
"settings"
:
{
"settings"
:
{
"timeframe"
:
300
,
"plot_type"
:
"line"
,
"blocks"
:
4
,
"legend"
:
true
,
"chartType"
:
"spline"
,
"height"
:
4
,
"xaxis"
:
"{
\"
title
\"
:{
\"
text
\"
:
\"
Time
\"
},
\"
type
\"
:
\"
datetime
\"
,
\"
floor
\"
:0}"
,
"value"
:
"var series = document.getElementById(
\"
time-series
\"
).value;
\n
data = [
\n
{label: 'CrS-TICP:Cryo-TE-31491', data: datasources[
\"
TS2
\"
][
\"
CrS-TICP:Cryo-TE-31491:Val
\"
][series]},
\n
{label: 'TS2-010CDL:Cryo-TE-82313', data: datasources[
\"
TS2
\"
][
\"
TS2-010CDL:Cryo-TE-82313:MeasValue
\"
][series]},
\n
{label: 'TS2-010CDL:Cryo-TE-82360', data: datasources[
\"
TS2
\"
][
\"
TS2-010CDL:Cryo-TE-82360:MeasValue
\"
][series]}
\n
];
\n
freeboard.showLoadingIndicator(false);
\n
return data;"
,
"yaxis"
:
"{
\"
title
\"
:{
\"
text
\"
:
\"
Values
\"
},
\"
minorTickInterval
\"
:
\"
auto
\"
,
\"
floor
\"
:0}"
,
"x_timestamp"
:
true
,
"series1"
:
"datasources[
\"
TS2
\"
][
\"
CrS-TICP:Cryo-TE-31491:Val
\"
][
\"
value
\"
]"
,
"zoom"
:
""
"series1label"
:
"CrS-TICP:Cryo-TE-31491"
,
"series2"
:
"datasources[
\"
TS2
\"
][
\"
TS2-010CDL:Cryo-TE-82313:MeasValue
\"
][
\"
value
\"
]"
,
"series2label"
:
"TS2-010CDL:Cryo-TE-82313"
,
"series3"
:
"datasources[
\"
TS2
\"
][
\"
TS2-010CDL:Cryo-TE-82360:MeasValue
\"
][
\"
value
\"
]"
,
"series3label"
:
"TS2-010CDL:Cryo-TE-82360"
}
}
},
},
{
{
"type"
:
"
highcharts-timeseries
"
,
"type"
:
"
flot_extended_plugin
"
,
"settings"
:
{
"settings"
:
{
"timeframe"
:
300
,
"plot_type"
:
"line"
,
"blocks"
:
4
,
"legend"
:
true
,
"chartType"
:
"spline"
,
"height"
:
4
,
"xaxis"
:
"{
\"
title
\"
:{
\"
text
\"
:
\"
Time
\"
},
\"
type
\"
:
\"
datetime
\"
,
\"
floor
\"
:0}"
,
"value"
:
"var series = document.getElementById(
\"
time-series
\"
).value;
\n
data = [
\n
{label: 'TS2-010CRM:Cryo-TE-068', data: datasources[
\"
TS2
\"
][
\"
TS2-010CRM:Cryo-TE-068:MeasValue
\"
][series]},
\n
{label: 'TS2-010CRM:Cryo-TE-064', data: datasources[
\"
TS2
\"
][
\"
TS2-010CRM:Cryo-TE-064:MeasValue
\"
][series]},
\n
{label: 'TS2-010CRM:Cryo-TE-069', data: datasources[
\"
TS2
\"
][
\"
TS2-010CRM:Cryo-TE-069:MeasValue
\"
][series]}
\n
];
\n
freeboard.showLoadingIndicator(false);
\n
return data;
\n
"
,
"yaxis"
:
"{
\"
title
\"
:{
\"
text
\"
:
\"
Values
\"
},
\"
minorTickInterval
\"
:
\"
auto
\"
,
\"
floor
\"
:0}"
,
"x_timestamp"
:
true
,
"series1"
:
"datasources[
\"
TS2
\"
][
\"
TS2-010CRM:Cryo-TE-068:MeasValue
\"
][
\"
value
\"
]"
,
"zoom"
:
""
"series1label"
:
"TS2-010CRM:Cryo-TE-068"
,
"series2"
:
"datasources[
\"
TS2
\"
][
\"
TS2-010CRM:Cryo-TE-064:MeasValue
\"
][
\"
value
\"
]"
,
"series2label"
:
"TS2-010CRM:Cryo-TE-064"
,
"series3"
:
"datasources[
\"
TS2
\"
][
\"
TS2-010CRM:Cryo-TE-069:MeasValue
\"
][
\"
value
\"
]"
,
"series3label"
:
"TS2-010CRM:Cryo-TE-069"
}
}
},
},
{
{
"type"
:
"
highcharts-timeseries
"
,
"type"
:
"
flot_extended_plugin
"
,
"settings"
:
{
"settings"
:
{
"timeframe"
:
300
,
"plot_type"
:
"line"
,
"blocks"
:
4
,
"legend"
:
true
,
"chartType"
:
"spline"
,
"height"
:
4
,
"xaxis"
:
"{
\"
title
\"
:{
\"
text
\"
:
\"
Time
\"
},
\"
type
\"
:
\"
datetime
\"
,
\"
floor
\"
:0}"
,
"value"
:
"var series = document.getElementById(
\"
time-series
\"
).value;
\n
data = [
\n
{label: 'TS2-010CRM:Cryo-TE-064', data: datasources[
\"
TS2
\"
][
\"
TS2-010CRM:Cryo-TE-064:MeasValue
\"
][series]},
\n
{label: 'TS2-010CDL:Cryo-TE-82314', data: datasources[
\"
TS2
\"
][
\"
TS2-010CDL:Cryo-TE-82314:MeasValue
\"
][series]},
\n
{label: 'CrS-TICP:Cryo-TE-31492', data: datasources[
\"
TS2
\"
][
\"
CrS-TICP:Cryo-TE-31492:Val
\"
][series]}
\n
];
\n
freeboard.showLoadingIndicator(false);
\n
return data;"
,
"yaxis"
:
"{
\"
title
\"
:{
\"
text
\"
:
\"
Values
\"
},
\"
minorTickInterval
\"
:
\"
auto
\"
,
\"
floor
\"
:0}"
,
"xticks"
:
""
,
"series1"
:
"datasources[
\"
TS2
\"
][
\"
TS2-010CRM:Cryo-TE-064:MeasValue
\"
][
\"
value
\"
]"
,
"x_timestamp"
:
true
,
"series1label"
:
"TS2-010CRM:Cryo-TE-064"
,
"zoom"
:
""
"series2"
:
"datasources[
\"
TS2
\"
][
\"
TS2-010CDL:Cryo-TE-82314:MeasValue
\"
][
\"
value
\"
]"
,
"series2label"
:
"TS2-010CDL:Cryo-TE-82314"
,
"series3"
:
"datasources[
\"
TS2
\"
][
\"
CrS-TICP:Cryo-TE-31492:Val
\"
][
\"
value
\"
]"
,
"series3label"
:
"CrS-TICP:Cryo-TE-31492:Val"
}
}
}
}
]
]
...
@@ -122,5 +128,5 @@
...
@@ -122,5 +128,5 @@
}
}
}
}
],
],
"columns"
:
4
"columns"
:
3
}
}
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