3 Commits

16 changed files with 781 additions and 201 deletions

View File

@@ -10,6 +10,10 @@
},
"Expert":{
"alarmMinor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Minor Alarm:",
"value" : " 90"}},
"alarmMajor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Major Alarm:",
"value" : "180"}},
"debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}},
"simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}}
},

View File

@@ -3,19 +3,125 @@
"hasFile": 0,
"loadInitFile": 0,
"hasDaq": 0,
"hasH5": 0,
"hasEpics": 0
"hasH5" : 0,
"hasEpics" : 0
},
"hdf": {
"destination" : "./"
"ElogBooks": {
"Proscan": {
"url": "https://elog-gfa.psi.ch:443/Proscan",
"destination": "/afs/psi.ch/intranet/Controls/tmp/elog/ePic/proscan/",
"Required": {"Eintrag": ["Problem", "Info", "Tuning",
"Betriebs-Wechsel", "Überbrückung",
"Pikett", "Status", "Meldung-AK3",
"Tips & Tricks", "Schicht-Übergabe",
"Schicht-Auftrag"]},
"Optional" : {"Effekt": ["","Abruch","Verzögerung","keiner","anderer"],
"System":["","Beamprobe Commissioning","Beamprobe Radial", "Diagnostik & Stopper Strahlweg",
"Extraktionselemente", "Gasversorgunung", "HF", "Interlock System", "Ionenquelle",
"Kontrollsysteme", "Kryo und Magnet", "Külung", "Mag.Speisegeräte",
"PaSS Gantry 1", "PaSS Gantry 2","PaSS Gantry 3", "PaSS OPTIS 2",
"PaSS Kontrollraum", "PaSS Frei","Phase Slit","Phasensonde",
"PSYS", "Schältplane Accel", "Speisegeräte Accel",
"TrimRods", "Vakuum", "Zyklotron allgemein", "Strahlweg", "SU",
"Andere Ursache"]
}
},
"Sandkasten": {
"url": "https://elog-gfa.psi.ch:443/Sandkasten",
"destination": "/afs/psi.ch/intranet/Controls/tmp/elog/ePic/sls/",
"Required" : {"Eintrag": ["Problem","Anregung"]},
"Optional" : {"Status": ["","Offen", "Geschlossen"]}
}
},
"Elog":{
"useELOGenv": 0,
"host": "elog-gfa.psi.ch",
"book": "Proscan",
"url": "https://elog-gfa.psi.ch/Proscan",
"destination": "/afs/psi.ch/intranet/Controls/tmp/bdbase/ePic/"
},
"stdlog":{
"destination": "/tmp/"
},
"screenshot": {
"destination": "/tmp/"
},
"url": {
"archiver" : "https://data-ui.psi.ch/preselect?c1=proscan-archive/"
},
"Shift":{
"type" :"PRO-HUSH:SHIFT-TYPE"
},
"headerMagnetSector" : ["G1","SH","G2","O2","PIF","G3"],
"header" : ["COMET","BMA1","G1","SH","G2","O2","PIF","G3","MASTER"],
"COMET":{
"status": "MMAC3:STR:2",
"colorObj" : "Machine",
"color": "gray",
"qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 gray)"
},
"MASTER":{
"status": "XPROSCAN:STAB:2",
"colorObj" : "Pk",
"color": "#00b7eb",
"qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #00b7eb)"
},
"BMA1":{
"status" : "BMA1:STA:2",
"colorObj" : "Machine",
"color": "gray",
"qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 gray)"
},
"BMD1":{
"status" : "BMD1:STA:2",
"colorObj" : "Machine",
"color": "gray",
"qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 gray)"
},
"B1B2":{
"status": "PRO-HUSH:SHIFT-TYPE",
"colorObj" : "Machine",
"color": "#9888b6",
"qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #9888b6)",
"device" : ["QMA1", "QMA2", "QMA3", "QMA4", "QMA5"],
"attribute" : ["SOL:2", "IST:2", "PWR:2"],
"standby": [-9.155, 9.155, -6.867, -6.867, 6.867],
"ref" : [-91.464, 102.359, -97.096, -44.269, 37.113],
"pwrref" : [9.065, 5.142, 4.061, 0.867, 0.597],
"iocDevice" : ["QMA1", "QMA2", "QMA5"]
},
"G1":{
"alarm": "PG1-HUSH:ALARM",
"status": "BME1:STA:2",
"mastershipStatus": "XPROSCAN:GANTRY1:STATUS",
"colorObj" : "Beamline",
"color": "#9888b6",
"qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #9888b6)",
"device" : ["QME1", "QME2", "AME1", "QME4", "QME5",
"AME2", "QME7", "QME8", "QME10", "QME11"],
"attribute" : ["SOL:2", "IST:2", "PWR"],
"standby": [-6.867, 6.867, 9.155, 6.867, 6.867, 9.155, 6.867, -6.867, 6.867, -6.867],
"ref" : [-43.813, 43.177, 157.28, 20.017, 30.544, 157,79, 42.203, -42.467, 52.179, -77.032],
"ref" : [-43.813, 43.177, 157.28, 20.017, 30.544, 157.79, 42.203, -42.467, 52.179, -77.032],
"pwrref" : [0.789, 0.764, 17.341, 0.164, 0.366, 17.482, 0.737, 0.736, 1.096, 2.464],
"iocDevice" : ["AME1", "AME2", "QME10"]
},
"SH":{
"alarm": "PSH-HUSH:ALARM",
"status": "BMA1:STA:2",
"colorObj" : "Machine",
"color": "gray",
"qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 gray)",
"device" : ["QMA6", "QMA7", "QMA8", "QMA9", "AMA2", "QMA10", "QMA11",
"QMA12", "QMA13", "AMA3"],
"attribute" : ["SOL:2", "IST:2", "PWR"],
"standby": [-6.8, 6.8, 6.8, -6.8, 6.8, 6.8, -6.8, -6.8,
6.8, 0],
"ref" : [-34.048, 26.68, 26.68, -34.05, 87.764, 37.424, -47.207, -38.156,
@@ -25,15 +131,33 @@
"iocDevice" : ["QMA7", "AMA2", "QMA12"]
},
"G2":{
"alarm": "PG2-HUSH:ALARM",
"status": "BMB1:STA:2",
"mastershipStatus": "XPROSCAN:GANTRY2:STATUS",
"colorObj" : "Beamline",
"color": "#9888b6",
"qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #9888b6)",
"device" : ["QMB1", "QMB2", "QMB3", "QMB4", "QMB5", "QMF1", "QMF2",
"QMF3", "QMF4", "QMF6", "QMF7", "AMF1", "AMF2", "AMF3"],
"attribute" : ["SOL:2", "IST:2", "PWR"],
"standby" : [-6.867, 6.867, -6.867, 6.867, -6.867, -7.553, 7.553, -7.553,
7.553, 7.553, -7.553, 10.758, 10.758, 23.804],
"ref": [-41.056, 36.548, -30.490, 52.433, -27.636, -37.412, 41.966, -37.296,
51.200, 53.657, -41.966, 109.543, 109.405, 251.492],
"pwrref" : [0.699, 0.545, 0.389, 1.152, 0.323, 0.374, 0.467, 0.378,
0.700, 0.772, 0.464, 7.114, 7.112, 21.727],
"iocDevice" : ["QMB2", "QMB4", "AMF1"]
"iocDevice" : ["QMB2", "QMB4", "AMF1"]
},
"O2":{
"alarm": "PO2-HUSH:ALARM",
"status": "BMC1:STA:2",
"mastershipStatus": "XPROSCAN:OPTIS2:STATUS",
"colorObj" : "Beamline",
"color": "#9888b6",
"qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #9888b6)",
"device" : ["QMC1", "QMC2", "QMC3", "QMC4", "AMC1", "QMC5", "QMC6",
"QMC7", "QMC8", "QMC9"],
"attribute" : ["SOL:2", "IST:2", "PWR"],
"standby": [-6.867, 6.867, 6.867, -6.867, 9.155, 6.867, -6.867, 6.867,
-6.867, 6.867],
"ref" : [-40.85, 26.974, 26.974, -40.851, 45.988, 30.890, -29.542, 33.742,
@@ -43,6 +167,15 @@
"iocDevice" : ["QMC2", "AMC1", "QMC7"]
},
"PIF":{
"alarm": "PPIF-HUSH:ALARM",
"status": "BMD1:STA:2",
"mastershipStatus": "XPROSCAN:PIF:STATUS",
"colorObj" : "ATHOS",
"color": "#2e5894",
"qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #2e5894)",
"device" : ["QMD1", "QMD2", "QMD3", "QMD4", "AMD1","QMD5", "QMD6", "QMD7",
"QMD8", "QMD9"],
"attribute" : ["SOL:2", "IST:2", "PWR"],
"standby": [-6.800, 6.800, 6.800, -6.800, 6.800, 6.800, -6.800, 6.800,
-6.800, 6.800],
"ref" : [-36.159, 34.434, 42.277, -43, 135, 61, -62, 37,
@@ -52,27 +185,23 @@
"iocDevice" : ["QMD2", "AMD1", "QMD9"]
},
"G3":{
"alarm": "PG3-HUSH:ALARM",
"status": "BMD2:STA:2",
"mastershipStatus": "XPROSCAN:GANTRY3:STATUS",
"colorObj" : "Beamline",
"color": "#9888b6",
"qlingrad": "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #9888b6)",
"device" : ["QMD10", "QMD11", "QMD12"],
"attribute" : ["SOL:2", "IST:2", "PWR"],
"standby": [-6.800, 6.800, -6.800],
"ref" : [-40.388, 68.393, -34.805],
"pwrref" : [0.64, 1.8, 0.46],
"iocDevice" : ["QMD10", "QMD11", "QMD12"]
},
"Parameters":{
"drawLine" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}},
"delayRamp" : {"flag" : 1, "data":{ "widget": "QDoubleSpinBox", "text" : "Ramp delay (s):",
"value" : 0.1, "min": 0.00, "max": 0.20, "step": 0.01,
"tooltip":"Wait time between sending set point to each magnet in 'Restore'/'Standby' "}},
"drawLine2" : {"flag" : 0, "data":{ "widget": "QHLine", "text" : "None", "value" : "None"}}
},
"Expert":{
"debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}},
"simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}}
},
"IOC": {
"resultsTabTitle" : "IOC"
},
"Master": "Controlroom",
"Reset": "HUSH!"
"hdf": {
"destination" : "/tmp"
},
"hdfGroups": {
"General":["Created","Author","Application","Comment","Filepath","Process","UID","User"]
}
}

View File

@@ -10,6 +10,10 @@
},
"Expert":{
"alarmMinor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Minor Alarm:",
"value" : " 90"}},
"alarmMajor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Major Alarm:",
"value" : "180"}},
"debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}},
"simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}}
},

View File

@@ -10,6 +10,10 @@
},
"Expert":{
"alarmMinor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Minor Alarm:",
"value" : " 90"}},
"alarmMajor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Major Alarm:",
"value" : "180"}},
"debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}},
"simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}}
},

View File

@@ -10,6 +10,10 @@
},
"Expert":{
"alarmMinor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Minor Alarm:",
"value" : " 90"}},
"alarmMajor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Major Alarm:",
"value" : "180"}},
"debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}},
"simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}}
},

View File

@@ -10,6 +10,10 @@
},
"Expert":{
"alarmMinor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Minor Alarm:",
"value" : " 90"}},
"alarmMajor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Major Alarm:",
"value" : "180"}},
"debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}},
"simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}}
},

View File

@@ -10,6 +10,10 @@
},
"Expert":{
"alarmMinor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Minor Alarm:",
"value" : " 90"}},
"alarmMajor": {"flag" : 1, "data":{"widget": "QLineEdit", "text" : "Minutes to Major Alarm:",
"value" : "180"}},
"debug": {"flag" : 0, "data":{ "widget": "None", "text" : "Debug", "value" : 0}},
"simulation": {"flag" : 1, "data":{ "widget": "None", "text" : "Dry run", "value" : 0}}
},

View File

@@ -58,6 +58,8 @@ class StartMain(BaseWindow):
self.setMinimumHeight(974)
self.setMinimumWidth(1460)
def prepare_elog_message(self):

View File

@@ -1,5 +1,5 @@
#!/bin/bash
cd /proscan/bd/applications/hush/hla/1.6.0
cd /proscan/bd/applications/hush/hla/1.8.0
# For use if script is sourced rather than executed
appNameDefault="hush.sh"

View File

@@ -1,5 +1,5 @@
#!/bin/bash
cd /proscan/bd/applications/hush/hla/1.5.0
cd /proscan/bd/applications/hush/hla/1.8.0
# For use if script is sourced rather than executed
appNameDefault="hush_g1.sh"
@@ -58,14 +58,11 @@ echo "PYTHON_VERSION $PYTHON_VERSION"
. /opt/gfa/python $PYTHON_VERSION
#/sf/bd/applications/OnlineModel/current/PythonModule:/sf/bd/applications/OnlineModel/current
#/sf/bd/applications/OnlineModel/default/scripts/VA:
#C_EXT version for Py 3.7:
export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.10.0
export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.13.0
if [ "${EXTRA_PYTHON_PATH_FLAG}" -gt "0" ] ; then
export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.10.0/common/python${PYTHON_VERSION_DIR}
export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.13.0/common/python${PYTHON_VERSION_DIR}
fi
echo $PYTHONPATH

View File

@@ -1,5 +1,5 @@
#!/bin/bash
cd /proscan/bd/applications/hush/hla/1.5.0
cd /proscan/bd/applications/hush/hla/1.8.0
# For use if script is sourced rather than executed
appNameDefault="hush_g2.sh"
@@ -23,7 +23,7 @@ fi
_EPICS_HOST_ARCH=${RHREL}-x86_64
_EPICS_BASE=base-7.0.8
# Select Python Version here. Currently one of 3.5, 3.7
# Select Python Version here. Currently one of 3.5, 3.7, 3.8, 3.10
PYTHON_VERSION=3.10
# Only neede for verison-specific packages, e.g., bigtree-
@@ -59,14 +59,11 @@ echo "PYTHON_VERSION $PYTHON_VERSION"
. /opt/gfa/python $PYTHON_VERSION
#/sf/bd/applications/OnlineModel/current/PythonModule:/sf/bd/applications/OnlineModel/current
#/sf/bd/applications/OnlineModel/default/scripts/VA:
#C_EXT version for Py 3.7:
export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.10.0
export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.13.0
if [ "${EXTRA_PYTHON_PATH_FLAG}" -gt "0" ] ; then
export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.10.0/common/python${PYTHON_VERSION_DIR}
export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.13.0/common/python${PYTHON_VERSION_DIR}
fi
echo $PYTHONPATH

View File

@@ -1,5 +1,5 @@
#!/bin/bash
cd /proscan/bd/applications/hush/hla/1.5.0
cd /proscan/bd/applications/hush/hla/1.8.0
# For use if script is sourced rather than executed
appNameDefault="hush_g3.sh"
@@ -59,14 +59,12 @@ echo "PYTHON_VERSION $PYTHON_VERSION"
. /opt/gfa/python $PYTHON_VERSION
#/sf/bd/applications/OnlineModel/current/PythonModule:/sf/bd/applications/OnlineModel/current
#/sf/bd/applications/OnlineModel/default/scripts/VA:
#C_EXT version for Py 3.7:
export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.10.0
export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.13.0
if [ "${EXTRA_PYTHON_PATH_FLAG}" -gt "0" ] ; then
export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.10.0/common/python${PYTHON_VERSION_DIR}
export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.13.0/common/python${PYTHON_VERSION_DIR}
fi
echo $PYTHONPATH

View File

@@ -1,5 +1,5 @@
#!/bin/bash
cd /proscan/bd/applications/hush/hla/1.5.0
cd /proscan/bd/applications/hush/hla/1.8.0
# For use if script is sourced rather than executed
appNameDefault="hush_o2.sh"
@@ -23,7 +23,7 @@ fi
_EPICS_HOST_ARCH=${RHREL}-x86_64
_EPICS_BASE=base-7.0.8
# Select Python Version here. Currently one of 3.5, 3.7
# Select Python Version here. Currently one of 3.5, 3.7, 3,8, 3.10
PYTHON_VERSION=3.10
# Only neede for verison-specific packages, e.g., bigtree-
@@ -60,15 +60,13 @@ echo "PYTHON_VERSION $PYTHON_VERSION"
. /opt/gfa/python $PYTHON_VERSION
#/sf/bd/applications/OnlineModel/current/PythonModule:/sf/bd/applications/OnlineModel/current
#/sf/bd/applications/OnlineModel/default/scripts/VA:
#C_EXT version for Py 3.7:
export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.10.0
export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.13.0
if [ "${EXTRA_PYTHON_PATH_FLAG}" -gt "0" ] ; then
export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.10.0/common/python${PYTHON_VERSION_DIR}
export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.13.0/common/python${PYTHON_VERSION_DIR}
fi
echo $PYTHONPATH

View File

@@ -1,5 +1,5 @@
#!/bin/bash
cd /proscan/bd/applications/hush/hla/1.5.0
cd /proscan/bd/applications/hush/hla/1.8.0
# For use if script is sourced rather than executed
appNameDefault="hush_pif.sh"
@@ -61,15 +61,12 @@ echo "PYTHON_VERSION $PYTHON_VERSION"
. /opt/gfa/python $PYTHON_VERSION
#/sf/bd/applications/OnlineModel/current/PythonModule:/sf/bd/applications/OnlineModel/current
#/sf/bd/applications/OnlineModel/default/scripts/VA:
#C_EXT version for Py 3.7:
export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.10.0
export PYTHONPATH=.:/opt/gfa/cafe/python/pycafe/cafe-1.21.0/lib/${_EPICS_HOST_ARCH}:/proscan/bd/applications/deps/apps4ops/v1.13.0
if [ "${EXTRA_PYTHON_PATH_FLAG}" -gt "0" ] ; then
export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.10.0/common/python${PYTHON_VERSION_DIR}
export PYTHONPATH=$PYTHONPATH:/proscan/bd/applications/deps/apps4ops/v1.13.0/common/python${PYTHON_VERSION_DIR}
fi
echo $PYTHONPATH

File diff suppressed because it is too large Load Diff

42
timediff.py Normal file
View File

@@ -0,0 +1,42 @@
from datetime import datetime
import time
import PyCafe
cafe = PyCafe.CyCafe()
pd=cafe.getPV("BMA1:STA:2")
tz = pd.tsDate
time0 = datetime(tz[0], tz[1], tz[2], tz[3], tz[4], tz[5])
tn = datetime.now()
time1 = datetime(tn.year, tn.month, tn.day, tn.hour, tn.minute, tn.second)
difference = time1 - time0
minutes = divmod(difference.total_seconds(), 60)
print('Total difference in minutes: ', int(minutes[0]), 'minutes', int(minutes[1]), 'seconds')
def time_difference():
tn = datetime.now()
time1 = datetime(tn.year, tn.month, tn.day, tn.hour, tn.minute, tn.second)
difference = time1 - time0
return divmod(difference.total_seconds(), 60)
def cb(handle, pv, pvdata):
global time0
print(pv, handle)
pvdata.show()
tz = pvdata.tsDate
time0 = datetime(tz[0], tz[1], tz[2], tz[3], tz[4], tz[5])
print("time0 in callback", time0)
cafe.openMonitorPrepare()
cafe.monitorStart("BMA1:STA:2", cb=cb)
cafe.openMonitorNowAndWait(1.0)
for i in range(0, 360):
time.sleep(1)
minutes = time_difference()
print('Total difference in minutes: ', int(minutes[0]), 'minutes', int(minutes[1]), 'seconds')
print("time0 actual", time0)