diff --git a/epics/iocs/ISTTOKrpi/ISTTOKrpiApp/Db/ISTTOKstates.db b/epics/iocs/ISTTOKrpi/ISTTOKrpiApp/Db/ISTTOKstates.db index 642729b..b4a2706 100644 --- a/epics/iocs/ISTTOKrpi/ISTTOKrpiApp/Db/ISTTOKstates.db +++ b/epics/iocs/ISTTOKrpi/ISTTOKrpiApp/Db/ISTTOKstates.db @@ -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") diff --git a/epics/iocs/ISTTOKrpi/ISTTOKrpiApp/src/IsttokSeqExec.stt b/epics/iocs/ISTTOKrpi/ISTTOKrpiApp/src/IsttokSeqExec.stt index 8dd5702..55372d9 100644 --- a/epics/iocs/ISTTOKrpi/ISTTOKrpiApp/src/IsttokSeqExec.stt +++ b/epics/iocs/ISTTOKrpi/ISTTOKrpiApp/src/IsttokSeqExec.stt @@ -1,6 +1,7 @@ -/** +/** vim: set filetype=c : + * Use :SyntasticToggleMode * - * Project : ISTTOK slow Control Sequencer + * Project : ISTTOK slow Control Sequencer * Docs: https://www-csr.bessy.de/control/SoftDist/sequencer/ * * File : $Id$ @@ -16,7 +17,7 @@ * **/ //%% #include "errlog.h" - + program IsttokSeqExec %{#include "errlog.h"}% /* CONSTANT DECLARATION*/ @@ -26,7 +27,7 @@ short PCF_RELAY_OFF= 1; short PCF_INPUT_ON = 0; short PCF_INPUT_OFF= 1; short PCF_PULSE_ON = 1; - + short STRST_NonStarting = 0; short STRST_Starting1 = 1; short STRST_Starting2 = 2; @@ -65,12 +66,12 @@ 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; short POS_Emergency=6; - + short ON=1; short OFF=0; short START=1; @@ -82,31 +83,31 @@ short MINOR=1; short MAJOR=2; short INVALID=3; -/* PV variables */ +/* PV variables */ short IsttokOPSTATE; assign IsttokOPSTATE to "ISTTOK:central:OPSTATE"; monitor IsttokOPSTATE; - + int PulseNumber; assign PulseNumber to "ISTTOK:central:PULSE-NUMBER"; monitor PulseNumber; - + short IsttokLastOPSTATE; assign IsttokLastOPSTATE to "ISTTOK:central:LASTOPSTATE"; monitor IsttokLastOPSTATE; - + short IsttokOPREQ; assign IsttokOPREQ to "ISTTOK:central:OPREQ"; monitor IsttokOPREQ; - + short IsttokProcMode; assign IsttokProcMode to "ISTTOK:central:PROCESS-MODE"; monitor IsttokProcMode; - + short IsttokProcReq; assign IsttokProcReq to "ISTTOK:central:PROCESS-REQ"; monitor IsttokProcReq; - + short STARTINGSTATE; assign STARTINGSTATE to "ISTTOK:central:STARTINGSTATE"; monitor STARTINGSTATE; @@ -121,7 +122,7 @@ monitor CLEANINGMANMODE; short WSHOTINGSTATE; assign WSHOTINGSTATE to "ISTTOK:central:WSHOTINGSTATE"; - + short STOPPINGSTATE; assign STOPPINGSTATE to "ISTTOK:central:STOPPINGSTATE"; monitor STOPPINGSTATE; @@ -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"; @@ -212,37 +213,45 @@ assign IsttokShotClean_TorContactor to "ISTTOK:central:Clean-TorContactor"; short IsttokShotClean_TorPneuBreaker; assign IsttokShotClean_TorPneuBreaker to "ISTTOK:central:Clean-TorPneuBreaker"; - + short IsttokShotShot_TorPSTrigger; assign IsttokShotShot_TorPSTrigger to "ISTTOK:central:Shot-TorPSTrigger"; monitor IsttokShotShot_TorPSTrigger; - + short IsttokShotShot_TorPSDisable; assign IsttokShotShot_TorPSDisable to "ISTTOK:central:Shot-TorPSDisable"; - + short IsttokShotClean_PrimContactor; assign IsttokShotClean_PrimContactor to "ISTTOK:central:Clean-PrimContactor"; - + short IsttokShotClean_PrimPneuBreaker; assign IsttokShotClean_PrimPneuBreaker to "ISTTOK:central:Clean-PrimPneuBreaker"; - + short IsttokShotCountdown; assign IsttokShotCountdown to "ISTTOK:central:COUNTDOWN"; -monitor IsttokShotCountdown; - +monitor IsttokShotCountdown; + string IsttokShotCountdownScan; assign IsttokShotCountdownScan to "ISTTOK:central:COUNTDOWN.SCAN"; - + short IsttokEmergency; assign IsttokEmergency to "ISTTOK:central:Emergency"; monitor IsttokEmergency; - + 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 */ string msg; assign msg to "ISTTOK:central:TraceMessage.VAL"; @@ -258,68 +267,68 @@ ss PulseSequence { strcpy(msg, "INIT: Sequence Entry"); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); - + strcpy(msg, "Initializing..."); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); - + IsttokShotCountdown = 160; pvPut(IsttokShotCountdown); - + // IsttokProcMode = OFF; // UPON POWER-DOWN OR FAILURE PREVENT TO ENTER WAITSHOT ON POWER-UP! // pvPut(IsttokProcMode); - + IsttokShotClean_PrimContactor = PCF_RELAY_OFF; pvPut(IsttokShotClean_PrimContactor); - + IsttokShotClean_PrimPneuBreaker = PCF_RELAY_OFF; pvPut(IsttokShotClean_PrimPneuBreaker); - + IsttokShotBuzzer = PCF_RELAY_OFF; pvPut(IsttokShotBuzzer); - + IsttokShotCapBank_Charge = PCF_RELAY_OFF; pvPut(IsttokShotCapBank_Charge); - + IsttokShotCapBank_Discharge = PCF_RELAY_OFF; pvPut(IsttokShotCapBank_Discharge); - + IsttokShotVVessel_Filament = PCF_RELAY_OFF; pvPut(IsttokShotVVessel_Filament); - + IsttokShotGasIS_Valves = PCF_RELAY_OFF; pvPut(IsttokShotGasIS_Valves); - + IsttokShotLab_WarningLight = PCF_RELAY_OFF; pvPut(IsttokShotLab_WarningLight); - + IsttokShotClean_TorPneuBreaker = PCF_RELAY_OFF; pvPut(IsttokShotClean_TorPneuBreaker); - + IsttokShotClean_TorContactor = PCF_RELAY_OFF; pvPut(IsttokShotClean_TorContactor); - + IsttokShotShot_TorPSDisable = PCF_RELAY_OFF; pvPut(IsttokShotShot_TorPSDisable); - + IsttokShotShot_TorPSTrigger= OFF; pvPut(IsttokShotShot_TorPSTrigger); - + IsttokTMPump1_ControllerOff = OFF; pvPut(IsttokTMPump1_ControllerOff); - + IsttokTMPump1_ControllerOn = OFF; pvPut(IsttokTMPump1_ControllerOn); - + IsttokTMPump1_MotorOff = OFF; pvPut(IsttokTMPump1_MotorOff); - + 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"); pvPut(msg); @@ -337,7 +346,7 @@ ss PulseSequence { /* State change to Stopping */ // IsttokOPSTATE = POS_Stopping; // pvPut(IsttokOPSTATE); - } state Stopping + } state Stopping when (delay(5) && IsttokOPREQ == START ) { strcpy(msg, "State to Starting"); pvPut(msg); @@ -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,40 +398,53 @@ 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*/ } state Emergency when ( pvStatus(IsttokRPump1_Pressure) != pvStatOK || pvStatus(IsttokTMPump1_Emergency) != pvStatOK ) { - //when ( pvStatus(IsttokRPump1_Pressure) != pvStatOK || pvStatus(IsttokRPump2_Pressure) != pvStatOK || + //when ( pvStatus(IsttokRPump1_Pressure) != pvStatOK || pvStatus(IsttokRPump2_Pressure) != pvStatOK || // pvStatus(IsttokTMPump1_Emergency) != pvStatOK || pvStatus(IsttokTMPump2_Emergency) != pvStatOK) { /* 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,22 +471,23 @@ 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 when ( pvStatus(IsttokTMPump1_Emergency) != pvStatOK) { - //when ( pvStatus(IsttokTMPump1_Emergency) != pvStatOK || + //when ( pvStatus(IsttokTMPump1_Emergency) != pvStatOK || // pvStatus(IsttokTMPump2_Emergency) != pvStatOK) { /* Vacuum emergency: Pulse state change to Stopping */ IsttokOPREQ = STOP; @@ -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); @@ -488,7 +515,17 @@ ss PulseSequence { pvPut(IsttokShotShot_TorPSDisable); 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,17 +533,17 @@ 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 */ } state Stopping when ( pvStatus(IsttokTMPump1_Emergency) != pvStatOK) { - //when ( pvStatus(IsttokTMPump1_Emergency) != pvStatOK || + //when ( pvStatus(IsttokTMPump1_Emergency) != pvStatOK || // pvStatus(IsttokTMPump2_Emergency) != pvStatOK) { /* Vacuum emergency: Pulse state change to Stopping */ IsttokOPREQ = STOP; @@ -516,9 +553,10 @@ ss PulseSequence { errlogSevPrintf(MAJOR, "%s\n",msg); } state Stopping } - /* State Stopping */ + + /* ************** State Stopping *********** */ state Stopping { - entry{ + entry{ /*Just to be sure */ IsttokProcReq = STOP; pvPut(IsttokProcReq); @@ -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); @@ -552,25 +590,25 @@ ss PulseSequence { errlogSevPrintf(MAJOR, "%s\n",msg); IsttokShotShot_TorPSDisable = PCF_RELAY_OFF; pvPut(IsttokShotShot_TorPSDisable); - + strcpy(msg, "EMERGENCY: CAPBANK Charge OFF"); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); IsttokShotCapBank_Charge = PCF_RELAY_OFF; pvPut(IsttokShotCapBank_Charge); - + strcpy(msg, "EMERGENCY: CAPBANK CrowBar Close"); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); IsttokShotCapBank_Discharge = PCF_RELAY_OFF; pvPut(IsttokShotCapBank_Discharge); - + strcpy(msg, "EMERGENCY: GIS Valves CLOSE"); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); IsttokShotGasIS_Valves = PCF_RELAY_OFF; pvPut(IsttokShotGasIS_Valves); - + strcpy(msg, "EMERGENCY: Filament OFF"); pvPut(msg); errlogSevPrintf(MAJOR, "%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"); @@ -608,7 +646,7 @@ ss PulseSequence { } state Stopped when (delay(1.0) && (IsttokEmergency == OFF) && (IsttokOPSTATE == POS_Stopped)){ - + strcpy(msg, "State to Stopped"); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); @@ -688,7 +726,7 @@ ss StartingSequence { } state NonStarting //when ( (pvStatus(IsttokRPump1_Pressure) == pvStatOK) && (pvStatus(IsttokRPump2_Pressure) == pvStatOK)) { when ( pvStatus(IsttokRPump1_Pressure) == pvStatOK) { - + strcpy(msg, "TMP1 MotorOn ON" ); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); @@ -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 @@ -711,7 +749,7 @@ ss StartingSequence { //IsttokSTARTINGSTATE = STRST_NonStarting; //pvPut(IsttokSTARTINGSTATE); } state NonStarting - when (TMPump1NormalOperation == PCF_INPUT_ON) { // TODO insert TMP2 Test + when (TMPump1NormalOperation == PCF_INPUT_ON) { // TODO insert TMP2 Test strcpy(msg, "TMP1 operating Normal"); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); @@ -731,15 +769,15 @@ ss CleaningSequence{ state NonCleaning{ entry{ strcpy(msg, "GIS Valves CLOSE"); - pvPut(msg); + pvPut(msg); IsttokShotGasIS_Valves = PCF_RELAY_OFF; pvPut(IsttokShotGasIS_Valves); - + strcpy(msg, "Filament OFF"); - pvPut(msg); + pvPut(msg); IsttokShotVVessel_Filament = PCF_RELAY_OFF; pvPut(IsttokShotVVessel_Filament); - + strcpy(msg, "Primary_CT OFF"); pvPut(msg); IsttokShotClean_PrimContactor = PCF_RELAY_OFF; @@ -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 @@ -907,7 +945,7 @@ ss ShotSequence { } state ShotEnd } state ShotWaitTrg { - when ((IsttokShotCountdown > 1800) || (IsttokOPSTATE != POS_WaitShot)) { + when ((IsttokShotCountdown > 1800) || (IsttokOPSTATE != POS_WaitShot)) { strcpy(msg, "Shooting Out"); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); @@ -933,7 +971,7 @@ ss ShotSequence { strcpy(msg, "Shoting 2 Out"); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); - } state ShotWaitTrg + } state ShotWaitTrg when ((IsttokOPSTATE == POS_WaitShot) && (IsttokShotCountdown == -61)) { strcpy(msg, "Buzzer 1-Sound"); pvPut(msg); @@ -959,7 +997,7 @@ ss ShotSequence { strcpy(msg, "Shoting3 Out"); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); - } state ShotWaitTrg + } state ShotWaitTrg when (IsttokShotCountdown == -60) { strcpy(msg, "GIS Valves OPEN"); pvPut(msg); @@ -1056,7 +1094,7 @@ ss ShotSequence { errlogSevPrintf(NO_ALARM, "%s\n",msg); // PS Trigger Pulse IsttokShotShot_TorPSTrigger = ON; - pvPut(IsttokShotShot_TorPSTrigger); + pvPut(IsttokShotShot_TorPSTrigger); WSHOTINGSTATE = WSHTST_Shoting9; pvPut(WSHOTINGSTATE); } state Shoting9 @@ -1137,13 +1175,13 @@ ss ShotSequence { } state ShotEnd } state ShotEnd { - when (IsttokShotCountdown > 160 || IsttokOPSTATE != POS_WaitShot) { + when (IsttokShotCountdown > 160 || IsttokOPSTATE != POS_WaitShot) { strcpy(msg, "Terminated"); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n", msg); WSHOTINGSTATE = WSHTST_WaitTrg; pvPut(WSHOTINGSTATE); - } state ShotWaitTrg + } state ShotWaitTrg } } @@ -1151,7 +1189,7 @@ ss ShotSequence { ss StoppingSequence { state NonStopping { entry { - STOPPINGSTATE = STPST_NonStopping; + STOPPINGSTATE = STPST_NonStopping; pvPut(STOPPINGSTATE); } when (IsttokOPSTATE == POS_Stopping) { @@ -1162,25 +1200,25 @@ 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 + } state Stopping1 } state Stopping1 { - when (IsttokOPSTATE != POS_Stopping ) { } state NonStopping - when (TMPump1NormalOperation == PCF_INPUT_OFF) { // TODO insert TMP2 Test + when (IsttokOPSTATE != POS_Stopping ) { } state NonStopping + when (TMPump1NormalOperation == PCF_INPUT_OFF) { // TODO insert TMP2 Test strcpy(msg, "TMP1 Stopping"); pvPut(msg); errlogSevPrintf(NO_ALARM, "%s\n",msg); STOPPINGSTATE = STPST_Stopping2; pvPut(STOPPINGSTATE); - } state Stopping2 - } + } state Stopping2 + } state Stopping2 { when (IsttokOPSTATE != POS_Stopping ) { - } state NonStopping + } state NonStopping when (delay(5.0) && IsttokTMPump1_ManualValve==OFF) { strcpy(msg, "Manual Valve Closed Checked"); pvPut(msg); @@ -1194,11 +1232,11 @@ ss StoppingSequence { pvPut(IsttokRPump2_Motor); STOPPINGSTATE = STPST_Stopping3; pvPut(STOPPINGSTATE); - } state Stopping3 + } state Stopping3 } state Stopping3 { when (IsttokOPSTATE != POS_Stopping ) { - } state NonStopping + } state NonStopping when (delay(5)) { IsttokRPump1_Valve = PCF_RELAY_ON; pvPut(IsttokRPump1_Valve); @@ -1209,15 +1247,15 @@ ss StoppingSequence { pvPut(IsttokRPump2_Valve); STOPPINGSTATE = STPST_StoppingEnd; pvPut(STOPPINGSTATE); - } state StoppingEnd - } + } state StoppingEnd + } state StoppingEnd { - when (IsttokOPSTATE != POS_Stopping ) { } state NonStopping + when (IsttokOPSTATE != POS_Stopping ) { } state NonStopping } } /**** END PROGRAM ***/ - + /* when (IsttokShotCountdown > 159) { strcpy(msg, "Toroidal Field Recovered" ); pvPut(msg); @@ -1241,12 +1279,12 @@ ss StoppingSequence { // pvPut(IsttokShotCountdownScan); // IsttokShotCountdown = 0; // pvPut(IsttokShotCountdown); - } state ShotWaitTrg + } state ShotWaitTrg } - entry{ + entry{ IsttokRPump1_Motor = PCF_RELAY_ON; pvPut(IsttokRPump1_Motor); strcpy(msg, "Rotary Pumps 1/2 OFF"); @@ -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 diff --git a/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/access_security.acf b/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/access_security.acf index 1892d1c..a94fc6e 100644 --- a/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/access_security.acf +++ b/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/access_security.acf @@ -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) diff --git a/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/iocISTTOKrpi.req b/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/iocISTTOKrpi.req index f2f172c..ad20912 100644 --- a/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/iocISTTOKrpi.req +++ b/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/iocISTTOKrpi.req @@ -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 diff --git a/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/pvList.txt b/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/pvList.txt index 73a0a5a..a07ec49 100644 --- a/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/pvList.txt +++ b/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/pvList.txt @@ -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 diff --git a/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/save/iocISTTOKrpi.sav b/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/save/iocISTTOKrpi.sav index 2ce6435..558c939 100644 --- a/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/save/iocISTTOKrpi.sav +++ b/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/save/iocISTTOKrpi.sav @@ -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 diff --git a/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/st.cmd b/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/st.cmd index bf1002d..643fafd 100755 --- a/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/st.cmd +++ b/epics/iocs/ISTTOKrpi/iocBoot/iocISTTOKrpi/st.cmd @@ -75,4 +75,4 @@ iocInit create_monitor_set("$(IOC).req", 30) ## Start any sequence programs , use safe mode -seq IsttokSeqExec +seq IsttokSeqExec "unit=ISTTOK"