From 68c62d762327d1e1a77eb9b19634ad921e28221f Mon Sep 17 00:00:00 2001 From: Martino Ferrari Date: Tue, 27 Jan 2026 16:30:57 +0100 Subject: [PATCH] Implemented missing wait state (now missing only HVON states) --- .../Configurations/src/app_states.marte | 8 +- .../Configurations/src/data/epics.marte | 25 +++ .../Configurations/src/data/pxi.marte | 27 +++- .../Configurations/src/thread1/data.marte | 8 + .../src/thread1/state_management.marte | 147 ++++++++++++++++-- 5 files changed, 190 insertions(+), 25 deletions(-) diff --git a/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/app_states.marte b/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/app_states.marte index a1c9ac2..b91035e 100644 --- a/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/app_states.marte +++ b/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/app_states.marte @@ -21,7 +21,6 @@ } } } - +WaitStandby = { Class = RealTimeState +Threads = { @@ -64,14 +63,13 @@ } } } -/* +WaitPermit = { Class = RealTimeState +Threads = { Class = ReferenceContainer +Thread1 = { Class = RealTimeThread - Functions = { Timer1kHzGAM CCPSWaveformGAM WFRecordGAM PreProgrammedGAM FHPSSetpointGAM FHPSRampupGAM InWaitPermitGAM choiseGAM EPICSOutputGAM GoWaitReadyFromWaitPermitGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM GoWaitHVONGAM GoWaitHVON_PREP_GAM GoWaitHVON_SDN_GAM GoWaitHVON_SDN_PREP_GAM GoErrorGAM } + Functions = { Timer1kHzGAM StateGAM CCPSWaveformGAM WFRecordGAM PreProgrammedGAM FHPSSetpointGAM FHPSRampupGAM ChoiceGAM EPICSOutputGAM GoWaitReadyFromWaitPermitGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM GoWaitHVONGAM GoWaitHVON_PREP_GAM GoWaitHVON_SDN_GAM GoWaitHVON_SDN_PREP_GAM GoErrorGAM } CPUs = 0x100 } +Thread2 = { @@ -81,11 +79,12 @@ } +Thread3 = { Class = RealTimeThread - Functions = { Timer100kHzGAM NI6528P3GAM NI6528P4GAM NI6528P5GAM NI6528P3PV2PortGAM NI6528P4PV2PortGAM NI6528P5PV2PortGAM NI6528P3WriteGAM NI6528P4WriteGAM } + Functions = { FastTimerGAM NI6528P3GAM NI6528P4GAM NI6528P5GAM NI6528P3PV2PortGAM NI6528P4PV2PortGAM NI6528P5PV2PortGAM NI6528P3WriteGAM NI6528P4WriteGAM } CPUs = 0x400 } } } +/* // Real-Time state for HVPS sequence timing control. +WaitHVON = { Class = RealTimeState @@ -195,4 +194,3 @@ } } } - diff --git a/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/data/epics.marte b/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/data/epics.marte index 5ce0431..ca06049 100644 --- a/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/data/epics.marte +++ b/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/data/epics.marte @@ -83,6 +83,31 @@ PVName = "EC-GN-P01-GAF-FHPS:STAT-MANM" Type = uint32 } + //# Guncoil state readback + GCPS_ACT_RB = { + PVName = "EC-GN-P01-GAF-GCPS:PSU2130-ACT-RB" + Type = uint32 + } + //# Guncoil current monitor + GCPS_CURR_MON = { + PVName = "EC-GN-P01-GAF-GCPS:PSU2130-CURR-MON" + Type = float32 + } + //# Main coil state readback + MCPS_ACT_RB = { + PVName = "EC-GN-P01-GAF-MCPS:PSU2120-ACT-RB" + Type = uint32 + } + //# Main coil current monitor + MCPS_CURR_MON = { + PVName = "EC-GN-P01-GAF-MCPS:PSU2120-CURR-MON" + Type = float32 + } + //# Pre-program flag + PREP_MODE = { + PVName = "EC-GN-P01-GAF:STAT-PREP-MODE" + Type = uint32 + } } } +EPICSCAOutput = { diff --git a/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/data/pxi.marte b/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/data/pxi.marte index 08d166a..b272db3 100644 --- a/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/data/pxi.marte +++ b/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/data/pxi.marte @@ -22,36 +22,49 @@ +NI6528_DI = { Class = GAMDataSource // TODO Change Signals = { + //# PXI 6528 Board Status PXI6528_Status = { Type = uint32 } + //# DI.1 GYA_APS_FLT = { - // DI.1 Type = uint32 } + //# DI.3 GYA_BPS_FLT = { Type = uint32 - // DI.3 } + //# DI.4 MHVPS_OV = { Type = uint32 - // DI.4 } + //# DI.5 MHVPS_OC = { Type = uint32 - // DI.5 } + //# DI.6 MHVPS_FLT = { Type = uint32 - // DI.6 } + //# DI.9 or DI.14 PLC_ITL = { Type = uint32 - // DI.9 or DI.14 } + //# DI.15 PLC_STANDBY = { Type = uint32 - // DI.15 + } + //# DI.16 + PLC_READY = { + Type = uint32 + } + //# DI.21 + PLC_SYNCMODE = { + Type = uint32 + } + //# DI.18 + PLC_PERMIT = { + Type = uint32 } } } diff --git a/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/thread1/data.marte b/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/thread1/data.marte index 2bcdb8d..d98dc4a 100644 --- a/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/thread1/data.marte +++ b/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/thread1/data.marte @@ -32,5 +32,13 @@ MHVPS_REF = { Type = float32 } + //# FHPS Rump Up completed + FHPS_RU = { + Type = float32 + } + //# CCPS In operation flag + CCPS_IN_OPERATION = { + Type = uint32 + } } } diff --git a/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/thread1/state_management.marte b/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/thread1/state_management.marte index 891f7e8..a6d2e4b 100644 --- a/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/thread1/state_management.marte +++ b/EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Configurations/src/thread1/state_management.marte @@ -152,32 +152,28 @@ Operation = "AND" InputSignals = { MCPS_ACT_RB = { - DataSource = NI6528_DI // EPICSCAInput - Type = uint32 + DataSource = EPICSCAInput Comparator = "EQUALS" Value = 3 } - GYA_MCPS_CURR_MON = { - DataSource = NI6259_AI - Type = float32 + MCPS_CURR_MON = { + DataSource = EPICSCAInput Comparator = "GREATER" Value = 0.0 } GCPS_ACT_RB = { - DataSource = NI6528_DI - Type = uint32 + DataSource = EPICSCAInput Comparator = "EQUALS" Value = 3 } - GYA_GCPS_CURR_MON = { - DataSource = NI6259_AI + GCPS_CURR_MON = { + DataSource = EPICSCAInput Type = float32 Comparator = "GREATER" Value = 0.0 } FHPS_RU = { - DataSource = NI6528_DI - Type = uint32 + DataSource = DDB1 Comparator = "EQUALS" Value = 1 } @@ -201,8 +197,7 @@ Operation = "AND" InputSignals = { CCPS_IN_OPERATION = { - DataSource = NI6528_DI - Type = uint32 + DataSource = DDB1 Comparator = "EQUALS" Value = 1 } @@ -236,3 +231,129 @@ Function = GoWaitStandby } } +//# GAM in WaitPermit state. Check Permit and States of Operation Modes. ++GoWaitReadyFromWaitPermitGAM = { + Class = JAMessageGAM + Operation = OR + InputSignals = { + PLC_STANDBY = { + DataSource = NI6528_DI + Comparator = "EQUALS" + Value = 0 + } + PLC_READY = { + DataSource = NI6528_DI + Comparator = "EQUALS" + Value = 0 + } + } + +Event = { + Class = Message + Destination = StateMachine + Function = GoWaitReady + } +} ++GoWaitHVONGAM = { + Class = JAMessageGAM + Operation = AND + InputSignals = { + PLC_SYNCMODE = { + DataSource = NI6528_DI + Operator = "EQUALS" + Value = 0 + } + PREP_MODE = { + DataSource = EPICSCAInput + Operator = "EQUALS" + Value = 0 + } + PLC_PERMIT = { + DataSource = NI6528_DI + Operator = "EQUALS" + Value = 1 + } + } + +Event = { + Class = Message + Destination = StateMachine + Function = GoWaitHVON + } +} ++GoWaitHVON_PREP_GAM = { + Class = JAMessageGAM + Operation = AND + InputSignals = { + PLC_SYNCMODE = { + DataSource = NI6528_DI + Operator = "EQUALS" + Value = 0 + } + PREP_MODE = { + DataSource = EPICSCAInput + Operator = "EQUALS" + Value = 1 + } + PLC_PERMIT = { + DataSource = NI6528_DI + Operator = "EQUALS" + Value = 1 + } + } + +Event = { + Class = Message + Destination = StateMachine + Function = GoWaitHVON_PREP + } +} ++GoWaitHVON_SDN_GAM = { + Class = JAMessageGAM + Operation = AND + InputSignals = { + PLC_SYNCMODE = { + DataSource = NI6528_DI + Operator = "EQUALS" + Value = 1 + } + PREP_MODE = { + DataSource = EPICSCAInput + Operator = "EQUALS" + Value = 0 + } + PLC_PERMIT = { + DataSource = NI6528_DI + Operator = "EQUALS" + Value = 1 + } + } + +Event = { + Class = Message + Destination = StateMachine + Function = GoWaitHVON_SDN + } +} ++GoWaitHVON_SDN_PREP_GAM = { + Class = JAMessageGAM + Operation = AND + InputSignals = { + PLC_SYNCMODE = { + DataSource = NI6528_DI + Operator = "EQUALS" + Value = 1 + } + PREP_MODE = { + DataSource = EPICSCAInput + Operator = "EQUALS" + Value = 1 + } + PLC_PERMIT = { + DataSource = NI6528_DI + Operator = "EQUALS" + Value = 1 + } + } + +Event = { + Class = Message + Destination = StateMachine + Function = GoWaitHVON_SDN_PREP + } +}