Implementing more states

This commit is contained in:
Martino Ferrari
2026-01-27 10:36:39 +01:00
parent 6866d48ebc
commit d8fbf7c1f4
8 changed files with 576 additions and 7 deletions

View File

@@ -22,14 +22,13 @@
}
}
/*
+WaitStandby = {
Class = RealTimeState
+Threads = {
Class = ReferenceContainer
+Thread1 = {
Class = RealTimeThread
Functions = { Timer1kHzGAM CCPSWaveformGAM FHPSSetpointGAM FHPSRampupGAM InWaitStandbyGAM choiseGAM MCPSGAM GCPSGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM GoDisabledGAM GoWaitReadyGAM GoErrorGAM }
Functions = { Timer1kHzGAM StateGAM CCPSWaveformGAM FHPSSetpointGAM FHPSRampupGAM ChoiceGAM MCPSGAM GCPSGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM GoDisabledGAM GoWaitReadyGAM GoErrorGAM }
CPUs = 0x100
}
+Thread2 = {
@@ -39,7 +38,7 @@
}
+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
}
}
@@ -50,7 +49,7 @@
Class = ReferenceContainer
+Thread1 = {
Class = RealTimeThread
Functions = { Timer1kHzGAM CCPSWaveformGAM WFRecordGAM PreProgrammedGAM FHPSSetpointGAM FHPSRampupGAM InWaitReadyGAM choiseGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM GoWaitPermitGAM GoWaitStandbyFromReadyGAM GoErrorGAM }
Functions = { Timer1kHzGAM StateGAM CCPSWaveformGAM WFRecordGAM PreProgrammedGAM FHPSSetpointGAM FHPSRampupGAM ChoiceGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM GoWaitPermitGAM GoWaitStandbyFromReadyGAM GoErrorGAM }
CPUs = 0x100
}
+Thread2 = {
@@ -60,11 +59,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
}
}
}
/*
+WaitPermit = {
Class = RealTimeState
+Threads = {
@@ -178,7 +178,9 @@
Class = ReferenceContainer
+Thread1 = {
Class = RealTimeThread
Functions = { Timer1kHzGAM StateGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM ExitedHVArmedInjectionRFONGAM ResetPSsGAM ResetErrorGAM ChoiceGAM EPICSOutputGAM FHPSSetpointGAM FHPSRampupGAM CCPSWaveformGAM }
Functions = { Timer1kHzGAM StateGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM ExitedHVArmedInjectionRFONGAM ResetPSsGAM ResetErrorGAM ChoiceGAM EPICSOutputGAM CCPSWaveformGAM }
// REMOVED: GoErrorGAM (redundant), FHPSSetPointGAM and FHPSRumpUpGAM
// TODO: Discus about the removal
CPUs = 0x100
}
+Thread2 = {

View File

@@ -67,6 +67,22 @@
PVName = "EC-GN-P01-GAF-GCPS:STAT-MANM"
Type = uint32
}
FHPS_AUTO_TAGV = {
PVName = "EC-GN-P01-GAF-FHPS:PSU2610-AUTO-TAGV"
Type = float32
}
FHPS_AUTO_TIME = {
PVName = "EC-GN-P01-GAF-FHPS:PSU2610-AUTO-RU-TIME"
Type = float32
}
FHPS_AUTO_START = {
PVName = "EC-GN-P01-GAF-FHPS:PSU2610-AUTO-START"
Type = uint32
}
FHPS_MANM = {
PVName = "EC-GN-P01-GAF-FHPS:STAT-MANM"
Type = uint32
}
}
}
+EPICSCAOutput = {

View File

@@ -149,6 +149,10 @@
GYA_CCPS_MEAS_DCI = {
Type = float32
}
// TODO check where is measured
FHPS_MEAS_ACV = {
Type = float32
}
}
}
+PXI6368_3_DataSource = {

View File

@@ -0,0 +1,55 @@
#package jada_gyro.RTApp.Functions
//# Reset HVPS outputs. ToDo: Fix to access NI d.s.
+ResetPSsGAM = {
Class = ConstantGAM
OutputSignals = {
MHVPS_HVON = {
DataSource = DDB1
Type = uint32
Default = 0
}
BPS_HVON = {
DataSource = DDB1
Type = uint32
Default = 0
}
BPS_SWON = {
DataSource = DDB1
Type = uint32
Default = 0
}
APS_HVON = {
DataSource = DDB1
Type = uint32
Default = 0
}
APS_SWON = {
DataSource = DDB1
Type = uint32
Default = 0
}
// here
}
}
//# Update status. ToDo: Fix to access NI d.s.
+ExitedHVArmedInjectionRFONGAM = {
Class = ConstantGAM
OutputSignals = {
HVARMED = {
DataSource = DDB1
Type = uint32
Default = 0
}
HVINJECTION = {
DataSource = DDB1
Type = uint32
Default = 0
}
RFON = {
DataSource = DDB1
Type = uint32
Default = 0
}
}
}

View File

@@ -0,0 +1,109 @@
#package jada_gyro.RTApp.Functions
// GAM for prepro
+WFRecordGAM = {
Class = JAWFRecordGAM
Directory = "../Configurations" // TODO: Enter directory path for prepro files.
InputSignals = {
CSV_LOAD = {
DataSource = EPICSCAInput
Type = uint32
}
Filename = {
Alias = CSV_NAME
DataSource = EPICSCAInput
}
}
OutputSignals = {
PREP_TIME_WF = {
DataSource = DDB1
Type = float32
}
MHVPS_PREP_WF = {
DataSource = DDB1
Type = float32
}
BPS_PREP_WF = {
DataSource = DDB1
Type = float32
}
APS_PREP_WF = {
DataSource = DDB1
Type = float32
}
MCPS_PREP_WF = {
DataSource = DDB1
Type = float32
}
GCPS_PREP_WF = {
DataSource = DDB1
Type = float32
}
FHPS_PREP_WF = {
DataSource = DDB1
Type = float32
}
}
}
+PreProgrammedGAM = {
Class = JAPreProgrammedGAM
Directory = "../Configurations" // TODO: Enter the directory path for prepro files.
PreProgrammedPeriodMs = 1 // Parameter update periods in ms.
InputSignals = {
CSV_LOAD = {
DataSource = EPICSCAInput
Type = uint32
}
Filename = {
Alias = CSV_NAME
DataSource = EPICSCAInput
}
FHPS_REF = {
Alias = FHPS_AUTO_TAGV
DataSource = EPICSCAInput
Type = float32
}
RFON = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
}
}
OutputSignals = {
GYA_PREPRO_TIME = {
DataSource = DDB1
Type = int32
}
MHVPS_REF = {
DataSource = DDB1
Type = float32
}
BPS_REF = {
DataSource = DDB1
Type = float32
}
APS_REF = {
DataSource = DDB1
Type = float32
}
MCPS_TRG_CURR_SET = {
DataSource = DDB1
Type = float32
}
GCPS_TRG_CURR_SET = {
DataSource = DDB1
Type = float32
}
FHPS_PrePro = {
DataSource = DDB1
Type = float32
}
CSV_LOADED = {
DataSource = DDB1
Type = uint32
}
CSV_ERR = {
DataSource = DDB1
Type = uint32
}
}
}

View File

@@ -147,3 +147,69 @@
}
}
}
// GAM for FHPS ramping up operation.
+FHPSSetpointGAM = {
Class = IOGAM
InputSignals = {
FHPS_AUTO_TAGV = {
DataSource = EPICSCAInput
Type = float32
}
}
OutputSignals = {
FHPS_TAGV = {
DataSource = DDB1
Type = float32
}
}
}
+FHPSRampupGAM = {
Class = JARampupGAM
InputSignals = {
Currspv = {
Alias = FHPS_REF
DataSource = DDB1
Type = float32
}
Targetv = {
Alias = FHPS_TAGV
DataSource = DDB1
Type = float32
}
Time = {
Alias = FHPS_AUTO_TIME
DataSource = EPICSCAInput
Type = float32
}
Start = {
Alias = FHPS_AUTO_START
DataSource = EPICSCAInput
Type = uint32
}
PLC_STANDBY = {
Alias = PLC_STANDBY
DataSource = NI6528_DI
Type = uint32
}
MANUAL_AUTO = {
Alias = FHPS_MANM
DataSource = EPICSCAInput
Type = uint32
}
FHPS_PrePro = {
DataSource = DDB1
Type = float32
}
}
OutputSignals = {
FHPS_REF = {
DataSource = DDB1 // probably to be direct anaklog output
Type = float32
}
//TODO remove as not used
FHPS_AUTO_STAT = {
DataSource = DDB1
Type = uint32
}
}
}

View File

@@ -105,7 +105,7 @@
PLC_ITL = {
DataSource = NI6528_DI
ExpectedValue = 0
}
}
}
+Event = {
Class = Message
@@ -129,4 +129,110 @@
Function = GoWaitStandby
}
}
+GoDisabledGAM = {
Class = JAMessageGAM
Operation = "AND"
InputSignals = {
PLC_SELECT = {
DataSource = EPICSCAInput
Type = uint32
Operator = "EQUALS"
Value = 0
}
}
+Event = {
Class = Message
Destination = StateMachine
Function = GoDisabled
}
}
//# GAM in WaitReady state. Check MCPS,GCPS,FHPS state for state transition.
+GoWaitReadyGAM = {
Class = JAMessageGAM
Operation = "AND"
InputSignals = {
MCPS_ACT_RB = {
DataSource = NI6528_DI // EPICSCAInput
Type = uint32
Comparator = "EQUALS"
Value = 3
}
GYA_MCPS_CURR_MON = {
DataSource = NI6259_AI
Type = float32
Comparator = "GREATER"
Value = 0.0
}
GCPS_ACT_RB = {
DataSource = NI6528_DI
Type = uint32
Comparator = "EQUALS"
Value = 3
}
GYA_GCPS_CURR_MON = {
DataSource = NI6259_AI
Type = float32
Comparator = "GREATER"
Value = 0.0
}
FHPS_RU = {
DataSource = NI6528_DI
Type = uint32
Comparator = "EQUALS"
Value = 1
}
FHPS_MEAS_ACV = {
DataSource = NI6259_AI
Type = float32
Comparator = "GREATER"
Value = 0.0
}
}
+Event = {
Class = Message
Destination = StateMachine
Function = GoWaitReady
}
}
}
//# GAM in WaitReady state. Check PLC_READY and CCPS_IN_OPERATION status.
+GoWaitPermitGAM = {
Class = JAMessageGAM
Operation = "AND"
InputSignals = {
CCPS_IN_OPERATION = {
DataSource = NI6528_DI
Type = uint32
Comparator = "EQUALS"
Value = 1
}
PLC_READY = {
DataSource = NI6528_DI
Type = uint32
Comparator = "EQUALS"
Value = 1
}
}
+Event = {
Class = Message
Destination = StateMachine
Function = GoWaitPermit
}
}
+GoWaitStandbyFromReadyGAM = {
Class = JAMessageGAM
Operation = "AND"
InputSignals = {
PLC_STANDBY = {
DataSource = NI6528_DI
Type = uint32
Value = 0
Comparator = "EQUALS"
}
}
+Event = {
Class = Message
Destination = StateMachine
Function = GoWaitStandby
}
}

View File

@@ -0,0 +1,211 @@
#package jada_gyro.RTApp.Functions
// Digital Output port access.
// EPICS PV to one uint8 variable
+NI6528P3GAM = {
Class = JABitSumGAM
InputSignals = {
APS_HVON = {
DataSource = EPICSCAInput
Type = uint32
}
APS_SWON = {
DataSource = EPICSCAInput
Type = uint32
}
APS_STOP = {
DataSource = EPICSCAInput
Type = uint32
}
BPS_HVON = {
DataSource = EPICSCAInput
Type = uint32
}
BPS_SWON = {
DataSource = EPICSCAInput
Type = uint32
}
BPS_STOP = {
DataSource = EPICSCAInput
Type = uint32
}
BEAM_ON_STAT = {
DataSource = EPICSCAInput
Type = uint32
}
DO_REV5 = {
DataSource = EPICSCAInput
Type = uint32
}
}
OutputSignals = {
NI6528P3CurrentValue = {
DataSource = DDB1
Type = uint8
}
}
}
+NI6528P4GAM = {
Class = JABitSumGAM
InputSignals = {
DO_REV6 = {
DataSource = EPICSCAInput
Type = uint32
}
DO_REV7 = {
DataSource = EPICSCAInput
Type = uint32
}
DO_REV8 = {
DataSource = EPICSCAInput
Type = uint32
}
MHVPS_HVON = {
DataSource = EPICSCAInput
Type = uint32
}
MHVPS_STOP = {
DataSource = EPICSCAInput
Type = uint32
}
MHVPS_MODSW = {
DataSource = EPICSCAInput
Type = uint32
}
PCF_FLT = {
DataSource = EPICSCAInput
Type = uint32
}
HVARMED = {
DataSource = EPICSCAInput
Type = uint32
}
}
OutputSignals = {
NI6528P4CurrentValue = {
DataSource = DDB1
Type = uint8
}
}
}
+NI6528P5GAM = {
Class = JABitSumGAM
InputSignals = {
HVINJECTION = {
DataSource = EPICSCAInput
Type = uint32
}
RFON = {
DataSource = EPICSCAInput
Type = uint32
}
FHPS_RU = {
DataSource = EPICSCAInput
Type = uint32
}
SCM_RU = {
DataSource = EPICSCAInput
Type = uint32
}
SCM_RD = {
DataSource = EPICSCAInput
Type = uint32
}
CCPS_IN_OPERATION = {
DataSource = EPICSCAInput
Type = uint32
}
PXI_FLT = {
DataSource = DDB1
Type = uint32
}
NONE2 = {
DataSource = DDB1
Type = uint32
Default = 0
}
}
OutputSignals = {
NI6528P5CurrentValue = {
DataSource = DDB1
Type = uint8
}
}
}
// reversed uint8 variable (value to write on port.)
+NI6528P3PV2PortGAM = {
Class = JABitReverseGAM
InputSignals = {
NI6528P3CurrentValue = {
DataSource = DDB1
Type = uint8
}
}
OutputSignals = {
NI6528P3PortValue = {
DataSource = DDB1
Type = uint8
}
}
}
+NI6528P4PV2PortGAM = {
Class = JABitReverseGAM
InputSignals = {
NI6528P4CurrentValue = {
DataSource = DDB1
Type = uint8
}
}
OutputSignals = {
NI6528P4PortValue = {
DataSource = DDB1
Type = uint8
}
}
}
+NI6528P5PV2PortGAM = {
Class = JABitReverseGAM
InputSignals = {
NI6528P5CurrentValue = {
DataSource = DDB1
Type = uint8
}
}
OutputSignals = {
NI6528P5Value = {
DataSource = NI6528_DO_P5
Type = uint8
}
}
}
// write a uint8 port value to PXI data source.
+NI6528P3WriteGAM = {
Class = IOGAM
InputSignals = {
NI6528P3PortValue = {
DataSource = DDB1
Type = uint8
}
}
OutputSignals = {
NI6528P3Value = {
DataSource = NI6528_DO_P3
Type = uint8
}
}
}
+NI6528P4WriteGAM = {
Class = IOGAM
InputSignals = {
NI6528P4PortValue = {
DataSource = DDB1
Type = uint8
}
}
OutputSignals = {
NI6528P4Value = {
DataSource = NI6528_DO_P4
Type = uint8
}
}
}