From 762316bbc8b916a7faefd5c4b4ed6cfa9dd54086 Mon Sep 17 00:00:00 2001 From: Bernardo Carvalho Date: Thu, 14 Nov 2024 23:24:59 +0000 Subject: [PATCH] Added MDS Import files Signed-off-by: Bernardo Carvalho --- .gitignore | 4 + Configurations/RTApp-Isttok-Mds.cfg | 854 +++++++++++++++++++++++ Configurations/RTApp-Sdas-to-MDSplus.cfg | 444 ++++++++++++ Trees/CreateIsttokSdas.tcl | 9 + Trees/CreateRTAppMDSPlusTree.tcl | 76 ++ marte2-exports.sh | 31 + 6 files changed, 1418 insertions(+) create mode 100644 Configurations/RTApp-Isttok-Mds.cfg create mode 100644 Configurations/RTApp-Sdas-to-MDSplus.cfg create mode 100644 Trees/CreateRTAppMDSPlusTree.tcl create mode 100755 marte2-exports.sh diff --git a/.gitignore b/.gitignore index 259148f..f20007e 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,7 @@ *.exe *.out *.app + +# MDSplus +*.datafile +*.tree diff --git a/Configurations/RTApp-Isttok-Mds.cfg b/Configurations/RTApp-Isttok-Mds.cfg new file mode 100644 index 0000000..3782e40 --- /dev/null +++ b/Configurations/RTApp-Isttok-Mds.cfg @@ -0,0 +1,854 @@ ++EPICSCAInterface= { + Class = EPICS::EPICSCAClient + StackSize = 1048576 + CPUs = 0x1 + AutoStart = 0 + +PV_STATUS = { + Class = EPICS::EPICSPV + PVName = "MARTE2-DEMO-APP:STATUS" + PVType = int32 + } + +PV_COMMAND = { + Class = EPICS::EPICSPV + PVName = "MARTE2-DEMO-APP:COMMAND" + PVType = uint32 + Event = { + Destination = StateMachine + PVValue = Function + FunctionMap = {{"2", "GOTOPULSING"}, {"1", "GOTOWAITING_FOR_PRE"}, {"0", "GOTOIDLE"}} + } + } +} ++WebRoot = { + Class = HttpObjectBrowser + Root = "." + +ObjectBrowse = { + Class = HttpObjectBrowser + Root = "/" + } + +ResourcesHtml = { + Class = HttpDirectoryResource + BaseDir = "../../MARTe2/MARTe2/Resources/HTTP/" + } + +HttpMessageInterface = { + Class = HttpMessageInterface + +GOTOIDLE = { + Class = Message + Destination = StateMachine + Function = GOTOIDLE + Mode = ExpectsReply + } + +GOTOWAITING_FOR_PRE = { + Class = Message + Destination = StateMachine + Function = GOTOWAITING_FOR_PRE + Mode = ExpectsReply + } + +GOTOPULSING = { + Class = Message + Destination = StateMachine + Function = GOTOPULSING + Mode = ExpectsReply + } + +GOTOERR = { + Class = Message + Destination = StateMachineError + Function = GOTOERR + Mode = ExpectsReply + } + } +} ++WebServer = { + Class = HttpService + Port = 8084 + WebRoot = WebRoot + Timeout = 0 + ListenMaxConnections = 255 + AcceptTimeout = 1000 + MaxNumberOfThreads = 8 + MinNumberOfThreads = 1 +} ++StateMachine = { + Class = StateMachine + +INITIAL = { + Class = ReferenceContainer + +START = { + Class = StateMachineEvent + NextState = "IDLE" + NextStateError = "IDLE" + Timeout = 0 + +StartHttpServer = { + Class = Message + Destination = "WebServer" + Function = "Start" + Mode = ExpectsReply + } + +StartEPICSCAInterface = { + Class = Message + Destination = "EPICSCAInterface" + Mode = ExpectsReply + Function = "Start" + } + +OpenTreeMsg = { + Class = Message + Destination = "MdsLoopApp.Data.MDSWriter" + Function = OpenTree + Mode = ExpectsReply + +Parameters = { + Class = ConfigurationDatabase + param1 = 1 + } + } + +ChangeToStateIdleMsg = { + Class = Message + Destination = MdsLoopApp + Mode = ExpectsReply + Function = PrepareNextState + +Parameters = { + Class = ConfigurationDatabase + param1 = Idle + } + } + +StartNextStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StartNextStateExecution + Mode = ExpectsReply + } + } + } + +IDLE = { + Class = ReferenceContainer + +GOTOWAITING_FOR_PRE = { + Class = StateMachineEvent + NextState = "WAITING_FOR_PRE" + NextStateError = "IDLE" + Timeout = 0 + +ChangeToRunMsg = { + Class = Message + Destination = MdsLoopApp + Mode = ExpectsReply + Function = PrepareNextState + +Parameters = { + Class = ConfigurationDatabase + param1 = Run + } + } + +StopCurrentStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StopCurrentStateExecution + Mode = ExpectsReply + } + +StartNextStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StartNextStateExecution + Mode = ExpectsReply + } + } + } + +WAITING_FOR_PRE = { + Class = ReferenceContainer + +ENTER = { + Class = ReferenceContainer + +SetStatusPV = { + Class = Message + Destination = "EPICSCAInterface.PV_STATUS" + Function = CAPut + Mode = ExpectsReply + +Parameters = { + Class = ConfigurationDatabase + param1 = 1 + } + } + } + +GOTOPULSING = { + Class = StateMachineEvent + NextState = "PULSING" + NextStateError = "IDLE" + Timeout = 0 + +StopCurrentStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StopCurrentStateExecution + Mode = ExpectsReply + } + +StartNextStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StartNextStateExecution + Mode = ExpectsReply + } + } + } + +PULSING = { + Class = ReferenceContainer + +ENTER = { + Class = ReferenceContainer + +SetStatusPV = { + Class = Message + Destination = "EPICSCAInterface.PV_STATUS" + Function = CAPut + Mode = ExpectsReply + +Parameters = { + Class = ConfigurationDatabase + param1 = 2 + } + } + } + +GOTOIDLE = { + Class = StateMachineEvent + NextState = "IDLE" + NextStateError = "IDLE" + Timeout = 0 + +ChangeToIdleMsg = { + Class = Message + Destination = MdsLoopApp + Mode = ExpectsReply + Function = PrepareNextState + +Parameters = { + Class = ConfigurationDatabase + param1 = Idle + } + } + +StopCurrentStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StopCurrentStateExecution + Mode = ExpectsReply + } + +StartNextStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StartNextStateExecution + Mode = ExpectsReply + } + +SetStatusPV = { + Class = Message + Destination = "EPICSCAInterface.PV_STATUS" + Function = CAPut + Mode = ExpectsReply + +Parameters = { + Class = ConfigurationDatabase + param1 = 0 + } + } + } + } +} +$MdsLoopApp = { + Class = RealTimeApplication + +Functions = { + Class = ReferenceContainer + +GAMTimer = { + Class = IOGAM + InputSignals = { + Counter = { + DataSource = Timer + Type = uint32 + } + Time = { + Frequency = 10000 + DataSource = Timer + Type = uint32 + } + Idle_Thread1_CycleTime = { + DataSource = Timings + Alias = "Idle.Thread1_CycleTime" + Type = uint32 + } + Run_Thread1_CycleTime = { + DataSource = Timings + Alias = "Run.Thread1_CycleTime" + Type = uint32 + } + } + OutputSignals = { + Counter = { + DataSource = DDB1 + Type = uint32 + } + Time = { + DataSource = DDB1 + Type = uint32 + } + Idle_Thread1_CycleTime = { + DataSource = DDB1 + Type = uint32 + } + Run_Thread1_CycleTime = { + DataSource = DDB1 + Type = uint32 + } + } + } + +GAMWF1 = { + Class = WaveformGAM::WaveformSin + Amplitude = 10.0 + Frequency = 1.0 + Phase = 0.0 + Offset = 1.1 + InputSignals = { + Time = { + DataSource = "DDB1" + Type = uint32 //Supported type uint32 (int32 also valid since time cannot be negative. uint64 && int64 valid types) + } + } + OutputSignals = { + Wave = { + DataSource = "DDB1" + Type = float32 + } + } + } + +GAMConvert2Double = { + Class = "ConversionGAM" + InputSignals = { + Mirnov0 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov1 = { + DataSource = DDB1 + DataSource = "DDB1" + Type = float32 + } + Mirnov2 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov3 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov4 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov5 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov6 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov7 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov8 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov9 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov10= { + DataSource = "DDB1" + Type = float32 + } + Mirnov11 = { + DataSource = "DDB1" + Type = float32 + } + } + OutputSignals = { + MirnovD0 = { + DataSource = "DDB1" + Type = float64 + } + MirnovD1 = { + DataSource = DDB1 + DataSource = "DDB1" + Type = float64 + } + MirnovD2 = { + DataSource = "DDB1" + Type = float64 + } + MirnovD3 = { + DataSource = "DDB1" + Type = float64 + } + MirnovD4 = { + DataSource = "DDB1" + Type = float64 + } + MirnovD5 = { + DataSource = "DDB1" + Type = float64 + } + MirnovD6 = { + DataSource = "DDB1" + Type = float64 + } + MirnovD7 = { + DataSource = "DDB1" + Type = float64 + } + MirnovD8 = { + DataSource = "DDB1" + Type = float64 + } + MirnovD9 = { + DataSource = "DDB1" + Type = float64 + } + MirnovD10= { + DataSource = "DDB1" + Type = float64 + } + MirnovD11 = { + DataSource = "DDB1" + Type = float64 + } + } + } + +GAMSSM = { + Class = SSMGAM + StateMatrix = {{1.0 0}{0 1.0}} //Compulsory + InputMatrix = {{0 0 0 0}{0 0 0 0}} //Compulsory + OutputMatrix = {{0 0}} //Compulsory + FeedthroughMatrix = {{1 1 1 1}} //Optional + ResetInEachState = 1//Compulsory. 1–> reset in each state, 0–> reset if the previous state is different from the next state + SampleFrequency = 0.0001 // Currently optional and not used. + InputSignals = { + MirnovD0 = { //input of the SS + DataSource = "DDB1" + Type = float64 //Only supported type. + NumberOfElements = 1 + NumberOfDimensions = 1 // or 0 + Samples = 1 + } + MirnovD1 = { + DataSource = "DDB1" + Type = float64 //Only supported type. + NumberOfElements = 1 + NumberOfDimensions = 1 + Samples = 1 + } + MirnovD2 = { + DataSource = "DDB1" + Type = float64 //Only supported type. + NumberOfElements = 1 + NumberOfDimensions = 1 + Samples = 1 + } + MirnovD3 = { + DataSource = "DDB1" + Type = float64 //Only supported type. + NumberOfElements = 1 + NumberOfDimensions = 1 + Samples = 1 + } + } + OutputSignals = { + OutputSignal1 = { + DataSource = "DDB1" + Type = float64 + } + State0 = { + Type = float64 + DataSource = "DDB1" + } + State1 = { + Type = float64 + DataSource = "DDB1" + } + } + } + +GAMMDSReader = { + Class = IOGAM + InputSignals = { + MirnovMdsR0 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR1 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR2 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR3 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR4 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR5 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR6 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR7 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR8 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR9 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR10 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR11 = { + DataSource = MDSReader + Type = float32 + } + LangmuirMdsR0 = { + DataSource = MDSReader + Type = float32 + } + LangmuirMdsR1 = { + DataSource = MDSReader + Type = float32 + } + LangmuirMdsR2 = { + DataSource = MDSReader + Type = float32 + } + LangmuirMdsR3 = { + DataSource = MDSReader + Type = float32 + } + Time = { + DataSource = MDSReader + Type = uint32 + } + } + OutputSignals = { + Mirnov0 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov1 = { + DataSource = DDB1 + DataSource = "DDB1" + Type = float32 + } + Mirnov2 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov3 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov4 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov5 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov6 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov7 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov8 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov9 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov10= { + DataSource = "DDB1" + Type = float32 + } + Mirnov11 = { + DataSource = "DDB1" + Type = float32 + } + Langmuir0 = { + DataSource = "DDB1" + Type = float32 + } + Langmuir1 = { + DataSource = "DDB1" + Type = float32 + } + Langmuir2 = { + DataSource = "DDB1" + Type = float32 + } + Langmuir3 = { + DataSource = "DDB1" + Type = float32 + } + MdsTime = { + DataSource = "DDB1" + Type = uint32 + } + } + } + +GAMMDSWriter = { + Class = IOGAM + InputSignals = { + Mirnov0 = { + DataSource = "DDB1" + Type = float32 + } + OutputSignal1 = { + DataSource = "DDB1" + Type = float64 + } + CycleTime = { + DataSource = Timings + Alias = Idle.Thread1_CycleTime + Type = uint32 + } + } + OutputSignals = { + OutMdsW0 = { + DataSource = MDSWriter + Type = float32 + } + OutMdsW1 = { + DataSource = MDSWriter + Type = float64 + } + CycleTime = { + DataSource = MDSWriter + Type = uint32 + } + } + } + } + +Data = { + Class = ReferenceContainer + DefaultDataSource = DDB1 + +DDB1 = { + Class = GAMDataSource + } + +LoggerDataSource = { + Class = LoggerDataSource + } + +Timings = { + Class = TimingDataSource + } + +Timer = { + Class = LinuxTimer + SleepNature = "Default" + ExecutionMode = RealTimeThread + Signals = { + Counter = { + Type = uint32 + } + Time = { + Type = uint32 + } + } + } + +MDSReader = { + Class = MDSReader + TreeName = "isttoksdas" //Compulsory. Name of the MDSplus tree. + //TreeName = "rtappwriter" //Compulsory. Name of the MDSplus tree. + ShotNumber = 46241//Compulsory. 0 –> last shot number (to use 0 shotid.sys must exist) + Frequency = 10000 // in Hz. Is the cycle time of the real time application. + Signals = { + MirnovMdsR0 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_0.RAW" // node of the tree node +// \TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_0.RAW + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR1 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_1.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR2 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_2.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR3 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_3.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR4 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_4.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR5 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_5.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR6 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_6.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR7 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_7.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR8 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_8.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR9 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_9.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR10 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_10.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR11 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_11.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + LangmuirMdsR0 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_1.CHANNEL_0.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + LangmuirMdsR1 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_1.CHANNEL_1.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + LangmuirMdsR2 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_1.CHANNEL_2.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + LangmuirMdsR3 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC_1.CHANNEL_3.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + Time = { //Compulsory + Type = "uint32" //can be any of the supported types + NumberOfElements = 1 //must be always one. + } + } + } + +MDSWriter = { + Class = MDSWriter + NumberOfBuffers = 10 //Compulsory. Number of buffers in the circular buffer defined above. Each buffer is capable of holding a copy of all the DataSourceI signals. + CPUMask = 2 //Compulsory. Affinity assigned to the threads responsible for asynchronously flush data into the MDSplus database. + StackSize = 10000000 //Compulsory. Stack size of the thread above. + TreeName = "isttokoutput" //Compulsory. Name of the MDSplus tree. + PulseNumber = 1 //Optional. If -1 a new pulse will be created and the MDSplus pulse number incremented. + StoreOnTrigger = 0 //Compulsory. If 0 all the data in the circular buffer is continuously stored. If 1 data is stored when the Trigger signal is 1 (see below). + EventName = "updatejScope" //Compulsory. Event sent to jScope when TimeRefresh seconds have elapsed. + TimeRefresh = 5 //Compulsory. An event with the name set in the property EventName is sent to jScope when TimeRefresh seconds have elapsed. + Signals = { + OutMdsW0 = { //As many as required. + NodeName = "\TOP.OUT.OUT0" // node of the tree node + Period = 0.0001 //Compulsory. Period between signal samples. + AutomaticSegmentation = 0 + MakeSegmentAfterNWrites = 100 + } + OutMdsW1 = { //As many as required. + NodeName = "\TOP.OUT.OUT1" // node of the tree node + Period = 0.0001 //Compulsory. Period between signal samples. + AutomaticSegmentation = 0 + MakeSegmentAfterNWrites = 100 + } + CycleTime = { //As many as required. + NodeName = "\TOP.OUT.Cycle_Time" // node of the tree node + //NodeName = "Cycle_Time" //Compulsory. MDSplus node name + Period = 0.0001 //Compulsory. Period between signal samples. + AutomaticSegmentation = 0 + MakeSegmentAfterNWrites = 100 + } + } + } + } + +States = { + Class = ReferenceContainer + +Idle = { + Class = RealTimeState + +Threads = { + Class = ReferenceContainer + +Thread1 = { + Class = RealTimeThread + CPUs = 0x1 + Functions = {GAMTimer GAMWF1} + } + } + } + +Run = { + Class = RealTimeState + +Threads = { + Class = ReferenceContainer + +Thread1 = { + Class = RealTimeThread + CPUs = 0x1 + Functions = {GAMTimer GAMWF1 GAMMDSReader GAMConvert2Double GAMSSM GAMMDSWriter} + } + } + } + } + +Scheduler = { + Class = GAMScheduler + TimingDataSource = Timings + } +} +// vim: syntax=cpp ts=4 sw=4 sts=4 sr et diff --git a/Configurations/RTApp-Sdas-to-MDSplus.cfg b/Configurations/RTApp-Sdas-to-MDSplus.cfg new file mode 100644 index 0000000..a985498 --- /dev/null +++ b/Configurations/RTApp-Sdas-to-MDSplus.cfg @@ -0,0 +1,444 @@ ++EPICSCAInterface= { + Class = EPICS::EPICSCAClient + StackSize = 1048576 + CPUs = 0x1 + AutoStart = 0 + +PV_STATUS = { + Class = EPICS::EPICSPV + PVName = "MARTE2-DEMO-APP:STATUS" + PVType = int32 + } + +PV_COMMAND = { + Class = EPICS::EPICSPV + PVName = "MARTE2-DEMO-APP:COMMAND" + PVType = uint32 + Event = { + Destination = StateMachine + PVValue = Function + FunctionMap = {{"1", "GOTORUN"}, {"0", "GOTOIDLE"}} + } + } +} ++WebRoot = { + Class = HttpObjectBrowser + Root = "." + +ObjectBrowse = { + Class = HttpObjectBrowser + Root = "/" + } + +ResourcesHtml = { + Class = HttpDirectoryResource + BaseDir = "../../MARTe2/MARTe2/Resources/HTTP/" + } + +HttpMessageInterface = { + Class = HttpMessageInterface + +GOTOIDLE = { + Class = Message + Destination = StateMachine + Function = GOTOIDLE + Mode = ExpectsReply + } + +GOTORUN = { + Class = Message + Destination = StateMachine + Function = GOTORUN + Mode = ExpectsReply + } + +GOTOERR = { + Class = Message + Destination = StateMachineError + Function = GOTOERR + Mode = ExpectsReply + } + } +} ++WebServer = { + Class = HttpService + Port = 8084 + WebRoot = WebRoot + Timeout = 0 + ListenMaxConnections = 255 + AcceptTimeout = 1000 + MaxNumberOfThreads = 8 + MinNumberOfThreads = 1 +} ++StateMachine = { + Class = StateMachine + +INITIAL = { + Class = ReferenceContainer + +START = { + Class = StateMachineEvent + NextState = "IDLE" + NextStateError = "IDLE" + Timeout = 0 + +StartHttpServer = { + Class = Message + Destination = "WebServer" + Function = "Start" + Mode = ExpectsReply + } + +StartEPICSCAInterface = { + Class = Message + Destination = "EPICSCAInterface" + Mode = ExpectsReply + Function = "Start" + } + +OpenTreeMsg = { + Class = Message + Destination = "MdsLoopApp.Data.MDSWriter" + Function = OpenTree + Mode = ExpectsReply + +Parameters = { + Class = ConfigurationDatabase + param1 = 1 + } + } + +ChangeToStateIdleMsg = { + Class = Message + Destination = MdsLoopApp + Mode = ExpectsReply + Function = PrepareNextState + +Parameters = { + Class = ConfigurationDatabase + param1 = Idle + } + } + +StartNextStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StartNextStateExecution + Mode = ExpectsReply + } + } + } + +IDLE = { + Class = ReferenceContainer + +GOTORUN = { + Class = StateMachineEvent + NextState = "RUN" + NextStateError = "IDLE" + Timeout = 0 + +ChangeToRunMsg = { + Class = Message + Destination = MdsLoopApp + Mode = ExpectsReply + Function = PrepareNextState + +Parameters = { + Class = ConfigurationDatabase + param1 = Run + } + } + +StopCurrentStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StopCurrentStateExecution + Mode = ExpectsReply + } + +StartNextStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StartNextStateExecution + Mode = ExpectsReply + } + } + } + +RUN = { + Class = ReferenceContainer + +ENTER = { + Class = ReferenceContainer + +SetStatusPV = { + Class = Message + Destination = "EPICSCAInterface.PV_STATUS" + Function = CAPut + Mode = ExpectsReply + +Parameters = { + Class = ConfigurationDatabase + param1 = 1 + } + } + } + +GOTOIDLE = { + Class = StateMachineEvent + NextState = "IDLE" + NextStateError = "IDLE" + Timeout = 0 + +ChangeToIdleMsg = { + Class = Message + Destination = MdsLoopApp + Mode = ExpectsReply + Function = PrepareNextState + +Parameters = { + Class = ConfigurationDatabase + param1 = Idle + } + } + +StopCurrentStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StopCurrentStateExecution + Mode = ExpectsReply + } + +StartNextStateExecutionMsg = { + Class = Message + Destination = MdsLoopApp + Function = StartNextStateExecution + Mode = ExpectsReply + } + +SetStatusPV = { + Class = Message + Destination = "EPICSCAInterface.PV_STATUS" + Function = CAPut + Mode = ExpectsReply + +Parameters = { + Class = ConfigurationDatabase + param1 = 0 + } + } + } + } +} +$MdsLoopApp = { + Class = RealTimeApplication + +Functions = { + Class = ReferenceContainer + +GAMTimer = { + Class = IOGAM + InputSignals = { + Counter = { + DataSource = Timer + Type = uint32 + } + Time = { + Frequency = 10000 + DataSource = Timer + Type = uint32 + } + Idle_Thread1_CycleTime = { + DataSource = Timings + Alias = "Idle.Thread1_CycleTime" + Type = uint32 + } + Run_Thread1_CycleTime = { + DataSource = Timings + Alias = "Run.Thread1_CycleTime" + Type = uint32 + } + } + OutputSignals = { + Counter = { + DataSource = DDB1 + Type = uint32 + } + Time = { + DataSource = DDB1 + Type = uint32 + } + Idle_Thread1_CycleTime = { + DataSource = DDB1 + Type = uint32 + } + Run_Thread1_CycleTime = { + DataSource = DDB1 + Type = uint32 + } + } + } + +GAMWF1 = { + Class = WaveformGAM::WaveformSin + Amplitude = 10.0 + Frequency = 1.0 + Phase = 0.0 + Offset = 1.1 + InputSignals = { + Time = { + DataSource = "DDB1" + Type = uint32 //Supported type uint32 (int32 also valid since time cannot be negative. uint64 && int64 valid types) + } + } + OutputSignals = { + Wave = { + DataSource = "DDB1" + Type = float32 + } + } + } + +GAMMDSReader = { + Class = IOGAM + InputSignals = { + MirnovMdsR0 = { + DataSource = MDSReader + Type = float32 + } + MirnovMdsR1 = { + DataSource = MDSReader + Type = float32 + } + Time = { + DataSource = MDSReader + Type = uint32 + } + } + OutputSignals = { + Mirnov0 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov1 = { + DataSource = "DDB1" + Type = float32 + } + MdsTime = { + DataSource = "DDB1" + Type = uint32 + } + } + } + +GAMMDSWriter = { + Class = IOGAM + InputSignals = { + Mirnov0 = { + DataSource = "DDB1" + Type = float32 + } + Mirnov1 = { + DataSource = "DDB1" + Type = float32 + } + CycleTime = { + DataSource = Timings + Alias = Idle.Thread1_CycleTime + Type = uint32 + } + } + OutputSignals = { + OutMdsW0 = { + DataSource = MDSWriter + Type = float32 + } + OutMdsW1 = { + DataSource = MDSWriter + Type = float32 + } + CycleTime = { + DataSource = MDSWriter + Type = uint32 + } + } + } + } + +Data = { + Class = ReferenceContainer + DefaultDataSource = DDB1 + +DDB1 = { + Class = GAMDataSource + } + +LoggerDataSource = { + Class = LoggerDataSource + } + +Timings = { + Class = TimingDataSource + } + +Timer = { + Class = LinuxTimer + SleepNature = "Default" + ExecutionMode = RealTimeThread + Signals = { + Counter = { + Type = uint32 + } + Time = { + Type = uint32 + } + } + } + +MDSReader = { + Class = MDSReader + TreeName = "isttoksdas" //Compulsory. Name of the MDSplus tree. + //TreeName = "rtappwriter" //Compulsory. Name of the MDSplus tree. + ShotNumber = 46241//Compulsory. 0 –> last shot number (to use 0 shotid.sys must exist) + Frequency = 10000 // in Hz. Is the cycle time of the real time application. + Signals = { + MirnovMdsR0 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC1.CHANNELS.INPUT_00.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + MirnovMdsR1 = { + NodeName = "\TOP.HARDWARE.ATCA1.IOC1.CHANNELS.INPUT_01.RAW" // node of the tree node + Type = "float32" // Can be any of the node supported types + NumberOfElements = 1 + DataManagement = 0 //could be 0, 1 or 2 + HoleManagement = 1 //could be 0 or 1 + } + Time = { //Compulsory + Type = "uint32" //can be any of the supported types + NumberOfElements = 1 //must be always one. + } + } + } + +MDSWriter = { + Class = MDSWriter + NumberOfBuffers = 10 //Compulsory. Number of buffers in the circular buffer defined above. Each buffer is capable of holding a copy of all the DataSourceI signals. + CPUMask = 2 //Compulsory. Affinity assigned to the threads responsible for asynchronously flush data into the MDSplus database. + StackSize = 10000000 //Compulsory. Stack size of the thread above. + TreeName = "isttokoutput" //Compulsory. Name of the MDSplus tree. + PulseNumber = 1 //Optional. If -1 a new pulse will be created and the MDSplus pulse number incremented. + StoreOnTrigger = 0 //Compulsory. If 0 all the data in the circular buffer is continuously stored. If 1 data is stored when the Trigger signal is 1 (see below). + EventName = "updatejScope" //Compulsory. Event sent to jScope when TimeRefresh seconds have elapsed. + TimeRefresh = 5 //Compulsory. An event with the name set in the property EventName is sent to jScope when TimeRefresh seconds have elapsed. + Signals = { + OutMdsW0 = { //As many as required. + NodeName = "\TOP.OUT.OUT0" // node of the tree node + Period = 0.0001 //Compulsory. Period between signal samples. + AutomaticSegmentation = 0 + MakeSegmentAfterNWrites = 100 + } + OutMdsW1 = { //As many as required. + NodeName = "\TOP.OUT.OUT1" // node of the tree node + Period = 0.0001 //Compulsory. Period between signal samples. + AutomaticSegmentation = 0 + MakeSegmentAfterNWrites = 100 + } + CycleTime = { //As many as required. + NodeName = "\TOP.OUT.Cycle_Time" // node of the tree node + //NodeName = "Cycle_Time" //Compulsory. MDSplus node name + Period = 0.0001 //Compulsory. Period between signal samples. + AutomaticSegmentation = 0 + MakeSegmentAfterNWrites = 100 + } + } + } + } + +States = { + Class = ReferenceContainer + +Idle = { + Class = RealTimeState + +Threads = { + Class = ReferenceContainer + +Thread1 = { + Class = RealTimeThread + CPUs = 0x1 + Functions = {GAMTimer GAMWF1 } + } + } + } + +Run = { + Class = RealTimeState + +Threads = { + Class = ReferenceContainer + +Thread1 = { + Class = RealTimeThread + CPUs = 0x1 + Functions = {GAMTimer GAMWF1 GAMMDSReader GAMMDSWriter} + } + } + } + } + +Scheduler = { + Class = GAMScheduler + TimingDataSource = Timings + } +} +// vim: syntax=cpp ts=4 sw=4 sts=4 sr et diff --git a/Trees/CreateIsttokSdas.tcl b/Trees/CreateIsttokSdas.tcl index 54a2cc9..d48b2ed 100644 --- a/Trees/CreateIsttokSdas.tcl +++ b/Trees/CreateIsttokSdas.tcl @@ -26,6 +26,11 @@ put CLOCK_FREQ "20000" add node .CHANNELS set def .CHANNELS add node .INPUT_00 + +add node .INPUT_12 +add node .INPUT_13 +add node .INPUT_14 +add node .INPUT_15 set def .INPUT_00 add node RAW/usage=signal add node GAIN/usage=numeric @@ -157,6 +162,10 @@ put OFFSET "0.0" add node SIGNAL/usage=signal put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)" +set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS +set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS.INPUT_12 +add node IOCINTCHAN/usage=subtree + set def \ISTTOKSDAS::TOP.INP add node MEAS0/usage=signal diff --git a/Trees/CreateRTAppMDSPlusTree.tcl b/Trees/CreateRTAppMDSPlusTree.tcl new file mode 100644 index 0000000..47c9c9a --- /dev/null +++ b/Trees/CreateRTAppMDSPlusTree.tcl @@ -0,0 +1,76 @@ +edit rtappdemo/new + +add node .INP +add node .REFS +add node .ERRORS +add node .CONTROLS +add node .STATES +add node .PERF +add node TIME/usage=signal +add node TIMED/usage=signal + +set def \RTAPPDEMO::TOP.INP +add node MEAS0/usage=signal +add node MEAS0D/usage=signal +add node MEAS0F/usage=signal +add node MEAS0FD/usage=signal +add node MEAS1/usage=signal +add node MEAS1D/usage=signal +add node MEAS1F/usage=signal +add node MEAS1FD/usage=signal +add node MEAS2/usage=signal +add node MEAS2D/usage=signal +add node MEAS2F/usage=signal +add node MEAS2FD/usage=signal +add node MEAS3/usage=signal +add node MEAS3D/usage=signal +add node MEAS3F/usage=signal +add node MEAS3FD/usage=signal + +set def \RTAPPDEMO::TOP.REFS +add node REF0/usage=signal +add node REF0D/usage=signal +add node REF1/usage=signal +add node REF1D/usage=signal +add node REF2/usage=signal +add node REF2D/usage=signal +add node REF3/usage=signal +add node REF3D/usage=signal + +set def \RTAPPDEMO::TOP.ERRORS +add node ERROR0/usage=signal +add node ERROR0D/usage=signal +add node ERROR1/usage=signal +add node ERROR1D/usage=signal +add node ERROR2/usage=signal +add node ERROR2D/usage=signal +add node ERROR3/usage=signal +add node ERROR3D/usage=signal + +set def \RTAPPDEMO::TOP.CONTROLS +add node CONTROL0/usage=signal +add node CONTROL0D/usage=signal +add node CONTROL1/usage=signal +add node CONTROL1D/usage=signal +add node CONTROL2/usage=signal +add node CONTROL2D/usage=signal +add node CONTROL3/usage=signal +add node CONTROL3D/usage=signal + +set def \RTAPPDEMO::TOP.STATES +add node STATE0/usage=signal +add node STATE0D/usage=signal +add node STATE1/usage=signal +add node STATE1D/usage=signal +add node STATE2/usage=signal +add node STATE2D/usage=signal +add node STATE3/usage=signal +add node STATE3D/usage=signal + +set def \RTAPPDEMO::TOP.PERF +add node CYCLET/usage=signal +add node CYCLETD/usage=signal + +write +close +exit diff --git a/marte2-exports.sh b/marte2-exports.sh new file mode 100755 index 0000000..297c0fa --- /dev/null +++ b/marte2-exports.sh @@ -0,0 +1,31 @@ +# MARTe2 local envs for running/compiling MARTe2 Rt Apps +export TARGET=x86-linux +export MARTe2_HOME=~/git-repos/MARTe2 + +export MARTe2_DIR=$MARTe2_HOME/MARTe2 +export MARTe2_Components_DIR=$MARTe2_HOME/MARTe2-components +export MARTe2_Demos_DIR=~/git-repos/MARTe2-demos-padova + +export EPICS_BASE=/opt/epics/epics-base +export EPICSPVA=/opt/epics/epics-base +export EPICS_HOST_ARCH=linux-x86_64 + +#export EPICS_CA_ADDR_LIST="localhost 192.168.1.110 efda-marte.ipfn.tecnico.ulisboa.pt" +export EPICS_CA_ADDR_LIST="localhost" +export EPICS_CA_AUTO_ADDR_LIST="NO" + +export MDSPLUS_DIR=/usr/local/mdsplus +# export default_tree_path=$MARTe2_HOME/mdsplus-trees +export default_tree_path=$MARTe2_HOME/mdsplus-trees +export rtappdemo_path=~/git-repos/MARTe2-isttok/Trees +export rtappwriter_path=~/git-repos/MARTe2-isttok/Trees +export isttoksdas_path=~/git-repos/MARTe2-isttok/Trees +export isttokoutput_path=~/git-repos/MARTe2-isttok/Trees +# export rtappisttok_path=$MARTe2_HOME/mdsplus-trees + +export PATH=$MDSPLUS_DIR/bin:$EPICS_BASE/bin/$EPICS_HOST_ARCH:$PATH +#export SDN_CORE_INCLUDE_DIR=~/Projects/SDN_1.0.12_nonCCS/src/main/c++/include/ +#export SDN_CORE_LIBRARY_DIR=~/Projects/SDN_1.0.12_nonCCS/target/lib/ +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_DIR/Build/x86-linux/Core/:$EPICS_BASE/lib/$EPICS_HOST_ARCH +#:$SDN_CORE_LIBRARY_DIR +source /usr/local/mdsplus/setup.sh