Implementing HVON mode

This commit is contained in:
Martino Ferrari
2026-01-27 16:47:53 +01:00
parent 68c62d7623
commit 9a21634052
6 changed files with 222 additions and 3 deletions

View File

@@ -84,7 +84,6 @@
}
}
}
/*
// Real-Time state for HVPS sequence timing control.
+WaitHVON = {
Class = RealTimeState
@@ -92,7 +91,7 @@
Class = ReferenceContainer
+Thread1 = {
Class = RealTimeThread
Functions = { Timer1kHzGAM CCPSWaveformGAM FHPSSetpointGAM FHPSRampupGAM InWaitHVONGAM choiseGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM writeBeamONStateGAM writeHVArmedStateGAM writeHVInjectionStateGAM writeRFONStateGAM writeBeamONTimeGAM writeRFONTimeGAM FromWaitHVONToWaitStandby FromWaitHVONToWaitPermit GoErrorGAM }
Functions = { Timer1kHzGAM StateGAM CCPSWaveformGAM FHPSSetpointGAM FHPSRampupGAM ChoiceGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM FastStatesSync FromWaitHVONToWaitStandby FromWaitHVONToWaitPermit GoErrorGAM }
CPUs = 0x100
}
+Thread2 = {
@@ -102,11 +101,12 @@
}
+Thread3 = {
Class = RealTimeThread
Functions = { Timer100kHzGAM GAMEPICSCA StopRequestGAM ModeLimitGAM NI6528P3GAM NI6528P4GAM GAMRealTimeStateMachine NI6528P5GAM NI6528P5PV2PortGAM }
Functions = { FastTimerGAM GAMEPICSCA StopRequestGAM ModeLimitGAM NI6528P3GAM NI6528P4GAM GAMRealTimeStateMachine NI6528P5GAM NI6528P5PV2PortGAM }
CPUs = 0x400
}
}
}
/*
+WaitHVON_SDN = {
Class = RealTimeState
+Threads = {

View File

@@ -108,6 +108,31 @@
PVName = "EC-GN-P01-GAF:STAT-PREP-MODE"
Type = uint32
}
// Timing settings
MHVPS_DT = {
PVName = "EC-GN-P01-PMF:STAT-DT-HVON"
Type = uint32
}
APS_HVON_DT = {
PVName = "EC-GN-P01-PA1F:STAT-DT-HVON"
Type = uint32
}
APS_SWON_DT = {
PVName = "EC-GN-P01-PA1F:STAT-DT-SWON"
Type = uint32
}
BPS_HVON_DT = {
PVName = "EC-GN-P01-PB1F:STAT-DT-HVON"
Type = uint32
}
BPS_SWON_DT = {
PVName = "EC-GN-P01-PB1F:STAT-DT-SWON"
Type = uint32
}
SHOTLEN = {
PVName = "EC-GN-P01-GAF:STAT-DT-SHOTLEN"
Type = uint32
}
}
}
+EPICSCAOutput = {

View File

@@ -66,6 +66,10 @@
PLC_PERMIT = {
Type = uint32
}
//# DI.17
PLC_ON = {
Type = uint32
}
}
}
+NI6528_DO_P3 = {

View File

@@ -357,3 +357,67 @@
Function = GoWaitHVON_SDN_PREP
}
}
//# GAM in WaitHVON_xx states. If PLC_READY is zero, goto WaitStandby.
+FromWaitHVONToWaitStandby = {
Class = JAMessageGAM
Operation = AND
InputSignals = {
PLC_READY = {
DataSource = NI6528_DI
Comparator = EQUALS
Value = 0
}
}
+Event = {
Class = Message
Destination = StateMachine
Function = GoWaitStandby
}
}
//# GAM in WaitHVON_xx states. If PLC_PERMIT is zero, goto WaitPermit.
+FromWaitHVONToWaitPermit = {
Class = JAMessageGAM
Operation = AND
InputSignals = {
PLC_PERMIT = {
DataSource = NI6528_DI
Comparator = EQUALS
Value = 0
}
APS_HVON = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
Comparator = EQUALS
Value = 0
}
BPS_HVON = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
Comparator = EQUALS
Value = 0
}
MHVPS_HVON = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
Comparator = EQUALS
Value = 0
}
BPS_SWON = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
Comparator = EQUALS
Value = 0
}
APS_SWON = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
Comparator = EQUALS
Value = 0
}
}
+Event = {
Class = Message
Destination = StateMachine
Function = GoWaitPermit
}
}

View File

@@ -0,0 +1,58 @@
#package jada_gyro.RTApp.Functions
//# GAM used to sync data from Fast thread (th.3) to slow thread (th.1)
+FastStatesSync = {
Class = IOGAM
InputSignals = {
BEAM_ON_STAT = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
}
HVARMED = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
}
HVINJECTION = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
}
RFON = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
}
BeamONTime = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
}
RFONTime = {
DataSource = RealTimeThreadAsyncBridge
Type = uint32
}
}
OutputSignals = {
BEAM_ON_STAT = {
DataSource = DDB1
Type = uint32
}
HVARMED = {
DataSource = DDB1
Type = uint32
}
HVINJECTION = {
DataSource = DDB1
Type = uint32
}
RFON = {
DataSource = DDB1
Type = uint32
}
ELAPSED_TIME = {
DataSource = DDB1
Type = uint32
}
BEAM_ON_TIME = {
DataSource = DDB1
Type = uint32
}
}
}

View File

@@ -0,0 +1,68 @@
#package jada_gyro.RTApp
+Functions = {
//# Thread3 pulse parameter EPICS PVs read.
//# TODO: Should be better to read it in thread 1 and use a async bridge to copy to 3?
+GAMEPICSCA = {
Class = IOGAM
InputSignals = {
MHVPS_DT = {
DataSource = EPICSCAInput
Type = uint32
}
APS_HVON_DT = {
DataSource = EPICSCAInput
Type = uint32
}
APS_SWON_DT = {
DataSource = EPICSCAInput
Type = uint32
}
BPS_HVON_DT = {
DataSource = EPICSCAInput
Type = uint32
}
BPS_SWON_DT = {
DataSource = EPICSCAInput
Type = uint32
}
SHOTLEN = {
DataSource = EPICSCAInput
Type = uint32
}
PLC_ON = {
DataSource = NI6528_DI
}
}
OutputSignals = {
MHVPS_DT = {
DataSource = DDB3
Type = uint32
}
APS_HVON_DT = {
DataSource = DDB3
Type = uint32
}
APS_SWON_DT = {
DataSource = DDB3
Type = uint32
}
BPS_HVON_DT = {
DataSource = DDB3
Type = uint32
}
BPS_SWON_DT = {
DataSource = DDB3
Type = uint32
}
SHOTLEN = {
DataSource = DDB3
Type = uint32
}
PLC_ON = {
DataSource = DDB3
Type = uint32
}
}
}
}