added UPS Records

This commit is contained in:
Bernardo Carvalho
2021-11-29 17:27:13 +00:00
parent 2743219a13
commit 1a43cf78f0
7 changed files with 279 additions and 219 deletions

View File

@@ -92,6 +92,24 @@ record(calc, "$(P)$(R)WSHOTCALCSTATE") {
# field(SCAN,"1 second")
#}
record(bo, "$(P)$(R)UPS-OnBattery") {
info(autosaveFields, "VAL STAT")
field(DESC, "Main APC UPS On Battery status")
field(VAL, "0")
field(ZNAM, "OFF")
field(ONAM, "ON")
field(OSV, "MAJOR")
}
record(bo, "$(P)$(R)UPS-Shutdown") {
info(autosaveFields, "VAL STAT")
field(DESC, "Main APC UPS Shutdown request")
# field(VAL, "0")
field(ZNAM, "OFF")
field(ONAM, "ON")
field(OSV, "MAJOR")
}
record(bo, "$(P)$(R)OPREQ") {
info(autosaveFields, "VAL")
field(DESC, "Pulse Sequence Start/Stop")

View File

@@ -1,4 +1,5 @@
/**
/** vim: set filetype=c :
* Use :SyntasticToggleMode
*
* Project : ISTTOK slow Control Sequencer
* Docs: https://www-csr.bessy.de/control/SoftDist/sequencer/
@@ -65,7 +66,7 @@ short STPST_StoppingEnd = 4;
short POS_Stopped =0;
short POS_Starting=1;
short POS_Process =2;
short POS_Idle =2;
short POS_Clean =3;
short POS_WaitShot=4;
short POS_Stopping=5;
@@ -150,8 +151,8 @@ assign IsttokTMPump1_MotorOff to "ISTTOK:central:TMPump1-MotorOff";
short IsttokTMPump1_MotorOn;
assign IsttokTMPump1_MotorOn to "ISTTOK:central:TMPump1-MotorOn";
short IsttokTMPump2_Motor;
assign IsttokTMPump2_Motor to "ISTTOK:central:TMPump2-Motor";
/*short IsttokTMPump2_Motor;*/
/*assign IsttokTMPump2_Motor to "ISTTOK:central:TMPump2-Motor";*/
short TMPump1NormalOperation;
assign TMPump1NormalOperation to "ISTTOK:central:TMPump1-NormalOperation";
@@ -241,6 +242,14 @@ short IsttokTTSystem_tzero;
assign IsttokTTSystem_tzero to "ISTTOK:central:TTSystem-tzero";
monitor IsttokTTSystem_tzero;
short IsttokupsBatteryON;
assign IsttokupsBatteryON "{unit}:central:UPS-OnBattery";
monitor IsttokupsBatteryON;
short IsttokShutdown;
assign IsttokShutdown "ISTTOK:central:UPS-Shutdown";
monitor IsttokShutdown;
//string tmp1_stat;
/* Trace message record limited to 40 characters */
@@ -317,8 +326,8 @@ ss PulseSequence {
IsttokTMPump1_MotorOn = OFF;
pvPut(IsttokTMPump1_MotorOn);
IsttokTMPump2_Motor = PCF_RELAY_OFF;
pvPut(IsttokTMPump2_Motor);
// IsttokTMPump2_Motor = PCF_RELAY_OFF;
//pvPut(IsttokTMPump2_Motor);
if ((IsttokTMPump1_Power == PCF_INPUT_OFF)) {
strcpy(msg, "TMP1 Controller is OFF");
@@ -347,12 +356,13 @@ ss PulseSequence {
// pvPut(IsttokOPSTATE);
} state Starting
}
/* State Stopped */
/*********** State Stopped ****************** */
state Stopped {
entry{
entry{
IsttokLastOPSTATE = POS_Stopped;
pvPut(IsttokLastOPSTATE);
}
}
when(IsttokEmergency == ON){
strcpy(msg, "Emergency from Stopped");
pvPut(msg);
@@ -361,19 +371,21 @@ ss PulseSequence {
IsttokOPSTATE = POS_Stopped;
pvPut(IsttokOPSTATE);
} state Emergency
when (IsttokOPREQ == START) {
when ((IsttokOPREQ == START) && (IsttokupsBatteryON != ON)) {
strcpy(msg, "State to Starting");
pvPut(msg);
errlogSevPrintf(NO_ALARM, "%s\n",msg);
/* Pulse state change to Starting */
} state Starting
}
/* State Starting */
/******** State Starting ***********************/
state Starting {
entry{
entry{
IsttokOPSTATE = POS_Starting;
pvPut(IsttokOPSTATE);
}
}
when(IsttokEmergency == ON) {
strcpy(msg, "Emergency from Starting");
pvPut(msg);
@@ -386,27 +398,40 @@ ss PulseSequence {
errlogSevPrintf(MINOR, "%s\n",msg);
/* Pulse state change to Stopping */
} state Stopping
when (STARTINGSTATE == STRST_StartingEnd ) {
strcpy(msg, "State to Process");
strcpy(msg, "State to Idle");
pvPut(msg);
errlogSevPrintf(NO_ALARM, "%s\n",msg);
/* Pulse state change to Process*/
} state Process
/* Pulse state change to Idle*/
} state Idle
}
/* State Process */
state Process {
entry{
IsttokOPSTATE = POS_Process;
/********** State Idle ****************************/
state Idle {
entry{
IsttokOPSTATE = POS_Idle;
pvPut(IsttokOPSTATE);
IsttokLastOPSTATE = POS_Process;
IsttokLastOPSTATE = POS_Idle;
pvPut(IsttokLastOPSTATE);
IsttokShotShot_TorPSDisable = PCF_RELAY_OFF;
pvPut(IsttokShotShot_TorPSDisable);
IsttokProcReq = STOP;
pvPut(IsttokProcReq);
}
}
when (IsttokupsBatteryON == ON) {
strcpy(msg, "Power Emergency, go to Stopping");
pvPut(msg);
errlogSevPrintf(MAJOR, "%s\n",msg);
IsttokOPREQ = STOP;
pvPut(IsttokOPREQ);
/* State change to Stopping */
IsttokOPSTATE = POS_Stopping;
pvPut(IsttokOPSTATE);
} state Stopping
when(IsttokEmergency == ON){
strcpy(msg, "Emergency from Process");
strcpy(msg, "Emergency from Idle");
pvPut(msg);
errlogSevPrintf(MAJOR, "%s\n",msg);
/* Pulse state change to Emergency*/
@@ -418,8 +443,8 @@ ss PulseSequence {
/* Vacuum emergency: Pulse state change to Stopping */
IsttokOPREQ = STOP;
pvPut(IsttokOPREQ);
//strcpy(sendMail, "Vacuum Emergency while Process");
sprintf(sendMail, "R1:%1.1e T1:%d",IsttokRPump1_Pressure,IsttokTMPump1_Emergency);
//strcpy(sendMail, "Vacuum Emergency while Idle");
sprintf(sendMail, "Rpump1:%1.1e TMP1:%d",IsttokRPump1_Pressure,IsttokTMPump1_Emergency);
pvPut(sendMail);
} state Stopping
@@ -446,17 +471,18 @@ ss PulseSequence {
/* Pulse state change to WaitShot */
} state WaitShot
}
/* State Clean */
/******* State Clean ***************************/
state Clean {
entry{
IsttokOPSTATE = POS_Clean;
pvPut(IsttokOPSTATE);
}
when ((IsttokProcReq==STOP) && (CLEANINGSTATE == CLNST_NonCleaning)) {
strcpy(msg, "State to Process F Clean");
strcpy(msg, "State to Idle From Clean");
pvPut(msg);
errlogSevPrintf(NO_ALARM, "%s\n",msg);
} state Process
} state Idle
when (IsttokOPREQ == STOP) {} state Stopping
@@ -478,9 +504,10 @@ ss PulseSequence {
/* Pulse state change to Emergency*/
} state Emergency
}
/* State WaitShot */
/******** State WaitShot *************************/
state WaitShot {
entry{
entry{
strcpy(msg, "Toroidal Shot Enable");
pvPut(msg);
errlogSevPrintf(NO_ALARM, "%s\n",msg);
@@ -489,6 +516,16 @@ ss PulseSequence {
IsttokOPSTATE = POS_WaitShot;
pvPut(IsttokOPSTATE);
}
when (IsttokupsBatteryON == ON) {
strcpy(msg, "Power Emergency, go to Stopping");
pvPut(msg);
errlogSevPrintf(MAJOR, "%s\n",msg);
IsttokOPREQ = STOP;
pvPut(IsttokOPREQ);
/* State change to Stopping */
IsttokOPSTATE = POS_Stopping;
pvPut(IsttokOPSTATE);
} state Stopping
when(IsttokEmergency == ON){
strcpy(msg, "Emergency from WaitShot");
pvPut(msg);
@@ -496,10 +533,10 @@ ss PulseSequence {
/* Pulse state change to Emergency*/
} state Emergency
when (IsttokProcReq==STOP ) {
strcpy(msg, "State to Process");
strcpy(msg, "State to Idle");
pvPut(msg);
errlogSevPrintf(MINOR, "%s\n",msg);
} state Process
} state Idle
when (IsttokOPREQ == STOP) {
/* Pulse state change to Stopping */
@@ -516,7 +553,8 @@ ss PulseSequence {
errlogSevPrintf(MAJOR, "%s\n",msg);
} state Stopping
}
/* State Stopping */
/* ************** State Stopping *********** */
state Stopping {
entry{
/*Just to be sure */
@@ -529,7 +567,7 @@ ss PulseSequence {
pvPut(IsttokLastOPSTATE);
}
when (IsttokOPREQ == START ) {
when ((IsttokOPREQ == START) && (IsttokupsBatteryON != ON) ) {
strcpy(msg, "State to Starting");
pvPut(msg);
errlogSevPrintf(NO_ALARM, "%s\n",msg);
@@ -578,23 +616,23 @@ ss PulseSequence {
pvPut(IsttokShotVVessel_Filament);
}
when (delay(1.0) && (IsttokEmergency == OFF) && (IsttokOPSTATE == POS_WaitShot || IsttokOPSTATE==POS_Clean) ){
/* Pulse state change to Process */
strcpy(msg, "State to Process");
/* Pulse state change to Idle */
strcpy(msg, "State to Idle");
pvPut(msg);
errlogSevPrintf(NO_ALARM, "%s\n",msg);
IsttokProcReq = STOP;
pvPut(IsttokProcReq);
IsttokOPSTATE = POS_Process;
IsttokOPSTATE = POS_Idle;
pvPut(IsttokOPSTATE);
} state Process
when (delay(1.0) && (IsttokEmergency == OFF) && (IsttokOPSTATE == POS_Process)){
/* Pulse state change to Process */
strcpy(msg, "State to Process");
} state Idle
when (delay(1.0) && (IsttokEmergency == OFF) && (IsttokOPSTATE == POS_Idle)){
/* Pulse state change to Idle */
strcpy(msg, "State to Idle");
pvPut(msg);
errlogSevPrintf(NO_ALARM, "%s\n",msg);
IsttokOPSTATE = POS_Process;
IsttokOPSTATE = POS_Idle;
pvPut(IsttokOPSTATE);
} state Process
} state Idle
when (delay(1.0) && (IsttokEmergency == OFF) && (IsttokOPSTATE == POS_Starting)){
// TODO Check these 2 transictions
strcpy(msg, "State to Stopped");
@@ -697,8 +735,8 @@ ss StartingSequence {
strcpy(msg, "TMP2 Motor ON" );
pvPut(msg);
errlogSevPrintf(NO_ALARM, "%s\n",msg);
IsttokTMPump2_Motor = PCF_RELAY_ON;
pvPut(IsttokTMPump2_Motor);
// IsttokTMPump2_Motor = PCF_RELAY_ON;
// pvPut(IsttokTMPump2_Motor);
STARTINGSTATE = STRST_Starting4;
pvPut(STARTINGSTATE);
} state Starting4
@@ -858,7 +896,7 @@ ss CleaningSequence{
}
state Cleaning5{
when (IsttokProcReq==STOP) {
// } state Process
// } state Idle
// when(delay(1.0) && IsttokOPSTATE != POS_Clean){
strcpy(msg, "Toroidal-CT OFF");
pvPut(msg);
@@ -872,11 +910,11 @@ ss CleaningSequence{
pvPut(CLEANINGSTATE);
} state Cleaning4
/*
when (pvSeverity(IsttokVVesselTemperature) >= pvSevrMAJOR) {
// Temperature Limit Pulse state change to Process
when (pvSeverity(IsttokVVesselTemperature) >= pvSevrMAJOR) {
// Temperature Limit Pulse state change to Idle
IsttokProcReq = STOP;
pvPut(IsttokProcReq);
strcpy(msg, "Temperature Limit-> State to Process");
strcpy(msg, "Temperature Limit-> State to Idle");
pvPut(msg);
errlogSevPrintf(MINOR, "%s\n",msg);
} state Cleaning5
@@ -1162,8 +1200,8 @@ ss StoppingSequence {
IsttokTMPump1_MotorOff = ON;
pvPut(IsttokTMPump1_MotorOff);
IsttokTMPump2_Motor = PCF_RELAY_OFF;
pvPut(IsttokTMPump2_Motor);
// IsttokTMPump2_Motor = PCF_RELAY_OFF;
// pvPut(IsttokTMPump2_Motor);
STOPPINGSTATE = STPST_Stopping1;
pvPut(STOPPINGSTATE);
} state Stopping1
@@ -1254,7 +1292,7 @@ ss StoppingSequence {
errlogSevPrintf(NO_ALARM, "%s\n",msg);
IsttokRPump2_Motor = PCF_RELAY_ON;
pvPut(IsttokRPump2_Motor);
//IsttokLastOPSTATE = POS_Process;
//IsttokLastOPSTATE = POS_Idle;
//pvPut(IsttokLastOPSTATE);
}
// } state Stopping

View File

@@ -1,4 +1,5 @@
UAG(uag) {pi,opertok,codac-dev,pricardofc}
#UAG(uag) {pi,root,opertok,codac-dev,pricardofc}
UAG(uag) {pi,root,opertok,codac-dev}
HAG(hag) {rpi-isttok,opertok-desktop,atca2}
ASG(DEFAULT) {
RULE(1,READ)

View File

@@ -9,6 +9,7 @@ ISTTOK:central:CLEANINGMANMODE.VAL
ISTTOK:central:Emergency-UserButton.VAL
ISTTOK:central:TMPump1-ManualValve.VAL
ISTTOK:central:Shot-TorPSCurrent
ISTTOK:central:UPS-Shutdown
#ALARM Limits
#ISTTOK:central:RPump2-Pressure.HIGH

View File

@@ -1,78 +1,8 @@
ISTTOK:central:PULSE-NUMBER
ISTTOK:central:PCF8591:72:DAC
ISTTOK:central:TDA8444:32:DAC_CH0
ISTTOK:central:TDA8444:32:DAC_CH1
ISTTOK:central:TDA8444:32:DAC_CH2
ISTTOK:central:TDA8444:32:DAC_CH3
ISTTOK:central:TDA8444:32:DAC_CH4
ISTTOK:central:TDA8444:32:DAC_CH5
ISTTOK:central:TDA8444:32:DAC_CH6
ISTTOK:central:Shot-TorPSCurrent
ISTTOK:SR_0_State
ISTTOK:SR_1_State
ISTTOK:SR_2_State
ISTTOK:SR_3_State
ISTTOK:SR_4_State
ISTTOK:SR_5_State
ISTTOK:SR_6_State
ISTTOK:SR_7_State
ISTTOK:SR_disableMaxSecs
ISTTOK:central:OPSTATE
ISTTOK:central:STARTINGSTATE
ISTTOK:central:CLEANINGSTATE
ISTTOK:central:WSHOTINGSTATE
ISTTOK:central:STOPPINGSTATE
ISTTOK:central:PCF8574:56:REGISTER:READ
ISTTOK:central:PCF8574:57:REGISTER:READ
ISTTOK:central:PCF8574:60:REGISTER:READ
ISTTOK:central:PCF8574:61:REGISTER:READ
ISTTOK:central:CurrentTime
ISTTOK:central:TMPump1-Power
ISTTOK:central:TMPump1-Emergency
ISTTOK:central:TMPump1-Acceleration
ISTTOK:central:TMPump1-NormalOperation
ISTTOK:central:TMPump2-Emergency
ISTTOK:central:TMPump2-Acceleration
ISTTOK:central:TTSystem-tzero
ISTTOK:central:Emergency-PhysButton
ISTTOK:central:PCF8574:56:REGISTER:READ:FNOUT
ISTTOK:central:PCF8574:57:REGISTER:READ:FNOUT
ISTTOK:central:TMPump1-ControllerOnInv
ISTTOK:central:TMPump1-ControllerOffInv
ISTTOK:central:TMPump1-MotorOnInv
ISTTOK:central:TMPump1-MotorOffInv
ISTTOK:central:BuzzerInv
ISTTOK:central:Shot-TorPSTriggerInv
ISTTOK:central:PCF8574:56:REGISTER
ISTTOK:central:PCF8574:57:REGISTER
ISTTOK:central:PCF8574:60:REGISTER
ISTTOK:central:PCF8574:61:REGISTER
ISTTOK:central:PCF8591:72:CTRLREGISTER
ISTTOK:central:OPCALCSTATE
ISTTOK:central:STARTCALCSTATE
ISTTOK:central:STOPPINGCALCSTATE
ISTTOK:central:CLEANCALCSTATE
ISTTOK:central:WSHOTCALCSTATE
ISTTOK:central:COUNTDOWN
ISTTOK:central:COUNTER
ISTTOK:central:PCF8591:72:BYTE2_CH1
ISTTOK:central:PCF8591:72:BYTE2_CH2
ISTTOK:central:PCF8591:72:BYTE2_CH3
ISTTOK:central:Emergency
ISTTOK:central:LASTOPSTATE
ISTTOK:SR_rebootStatus
ISTTOK:SR_status
ISTTOK:SR_0_Status
ISTTOK:SR_1_Status
ISTTOK:SR_2_Status
ISTTOK:SR_3_Status
ISTTOK:SR_4_Status
ISTTOK:SR_5_Status
ISTTOK:SR_6_Status
ISTTOK:SR_7_Status
ISTTOK:central:TMPump2-Speed
ISTTOK:central:TMPump2-Current
ISTTOK:central:Shot-TorPSCurrentImage
ISTTOK:central:PCF8591:72:ADC_CH1
ISTTOK:central:PCF8591:72:ADC_CH2
ISTTOK:central:PCF8591:72:ADC_CH3
ISTTOK:central:UPS-OnBattery
ISTTOK:central:UPS-Shutdown
ISTTOK:central:OPREQ
ISTTOK:central:CLEANINGMANMODE
ISTTOK:central:FSTriggerStart
@@ -106,9 +36,75 @@ ISTTOK:SR_heartbeat
ISTTOK:SR_i_am_alive
ISTTOK:SR_deadIfZero
ISTTOK:SR_disable
ISTTOK:central:PCF8591:72:ADC_CH1
ISTTOK:central:PCF8591:72:ADC_CH2
ISTTOK:central:PCF8591:72:ADC_CH3
ISTTOK:central:PULSE-NUMBER
ISTTOK:central:PCF8591:72:DAC
ISTTOK:central:TDA8444:32:DAC_CH0
ISTTOK:central:TDA8444:32:DAC_CH1
ISTTOK:central:TDA8444:32:DAC_CH2
ISTTOK:central:TDA8444:32:DAC_CH3
ISTTOK:central:TDA8444:32:DAC_CH4
ISTTOK:central:TDA8444:32:DAC_CH5
ISTTOK:central:TDA8444:32:DAC_CH6
ISTTOK:central:Shot-TorPSCurrent
ISTTOK:SR_0_State
ISTTOK:SR_1_State
ISTTOK:SR_2_State
ISTTOK:SR_3_State
ISTTOK:SR_4_State
ISTTOK:SR_5_State
ISTTOK:SR_6_State
ISTTOK:SR_7_State
ISTTOK:SR_disableMaxSecs
ISTTOK:central:PCF8574:56:REGISTER:READ:FNOUT
ISTTOK:central:PCF8574:57:REGISTER:READ:FNOUT
ISTTOK:central:OPCALCSTATE
ISTTOK:central:STARTCALCSTATE
ISTTOK:central:STOPPINGCALCSTATE
ISTTOK:central:CLEANCALCSTATE
ISTTOK:central:WSHOTCALCSTATE
ISTTOK:central:COUNTDOWN
ISTTOK:central:COUNTER
ISTTOK:central:PCF8591:72:BYTE2_CH1
ISTTOK:central:PCF8591:72:BYTE2_CH2
ISTTOK:central:PCF8591:72:BYTE2_CH3
ISTTOK:central:Emergency
ISTTOK:central:TMPump1-ControllerOnInv
ISTTOK:central:TMPump1-ControllerOffInv
ISTTOK:central:TMPump1-MotorOnInv
ISTTOK:central:TMPump1-MotorOffInv
ISTTOK:central:BuzzerInv
ISTTOK:central:Shot-TorPSTriggerInv
ISTTOK:central:LASTOPSTATE
ISTTOK:SR_rebootStatus
ISTTOK:SR_status
ISTTOK:SR_0_Status
ISTTOK:SR_1_Status
ISTTOK:SR_2_Status
ISTTOK:SR_3_Status
ISTTOK:SR_4_Status
ISTTOK:SR_5_Status
ISTTOK:SR_6_Status
ISTTOK:SR_7_Status
ISTTOK:central:TMPump1-Power
ISTTOK:central:TMPump1-Emergency
ISTTOK:central:TMPump1-Acceleration
ISTTOK:central:TMPump1-NormalOperation
ISTTOK:central:TMPump2-Emergency
ISTTOK:central:TMPump2-Acceleration
ISTTOK:central:TTSystem-tzero
ISTTOK:central:Emergency-PhysButton
ISTTOK:central:PCF8574:56:REGISTER
ISTTOK:central:PCF8574:57:REGISTER
ISTTOK:central:PCF8574:60:REGISTER
ISTTOK:central:PCF8574:61:REGISTER
ISTTOK:central:PCF8591:72:CTRLREGISTER
ISTTOK:central:PCF8574:56:REGISTER:READ
ISTTOK:central:PCF8574:57:REGISTER:READ
ISTTOK:central:PCF8574:60:REGISTER:READ
ISTTOK:central:PCF8574:61:REGISTER:READ
ISTTOK:central:TMPump2-Speed
ISTTOK:central:TMPump2-Current
ISTTOK:central:Shot-TorPSCurrentImage
ISTTOK:central:TraceMessage
ISTTOK:central:LogMessage
ISTTOK:central:sendmail
@@ -140,3 +136,9 @@ ISTTOK:SR_6_Time
ISTTOK:SR_7_Name
ISTTOK:SR_7_StatusStr
ISTTOK:SR_7_Time
ISTTOK:central:OPSTATE
ISTTOK:central:STARTINGSTATE
ISTTOK:central:CLEANINGSTATE
ISTTOK:central:WSHOTINGSTATE
ISTTOK:central:STOPPINGSTATE
ISTTOK:central:CurrentTime

View File

@@ -1,5 +1,4 @@
# autosave R5.3 Automatically generated - DO NOT MODIFY - 210512-110358
! 1 channel(s) not connected - or not all gets were successful
# autosave R5.3 Automatically generated - DO NOT MODIFY - 211129-172335
ISTTOK:central:PULSE-NUMBER.VAL 0
ISTTOK:central:LogMessage.VAL
ISTTOK:central:LASTOPSTATE.VAL 5
@@ -7,6 +6,7 @@ ISTTOK:central:OPREQ 0
ISTTOK:central:PROCESS-MODE.VAL 0
ISTTOK:central:CLEANINGMANMODE.VAL 0
ISTTOK:central:Emergency-UserButton.VAL 0
ISTTOK:central:TMPump1-ManualValve.VAL 0
#ISTTOK:central:Shot-TorPSCurrent Search Issued
ISTTOK:central:TMPump1-ManualValve.VAL 1
ISTTOK:central:Shot-TorPSCurrent 32
ISTTOK:central:UPS-Shutdown 0
<END>

View File

@@ -75,4 +75,4 @@ iocInit
create_monitor_set("$(IOC).req", 30)
## Start any sequence programs , use safe mode
seq IsttokSeqExec
seq IsttokSeqExec "unit=ISTTOK"