diff --git a/algos/template/marte2cfg/algo_template_create_marte2_cfg.m b/algos/template/marte2cfg/algo_template_create_marte2_cfg.m index 3ce395fb1c281da9d4f498b44d4de1251886f0ad..a902b93732b50e6a45a4093c513609cbb2e22138 100644 --- a/algos/template/marte2cfg/algo_template_create_marte2_cfg.m +++ b/algos/template/marte2cfg/algo_template_create_marte2_cfg.m @@ -11,9 +11,11 @@ % source MDSplus shotnumber mdssrcshot=-1; % destination MDSplus shotnumber (-1 stands for increment current by 1) -mdsdstshot=1; +mdsdstshot=2; % verbosity level verbosity=2; +% MDS writer period +mdsperiod=1; startpath=pwd; fcnpath=fileparts(mfilename('fullpath')); @@ -80,7 +82,7 @@ diary off system('rm -rf mdswriter1.cfg'); diary mdswriter1.cfg for i=1:numel(outsignals) - fprintf("%s = { NodeName =""template.outputs.%s"" Period = 1 AutomaticSegmentation = 0 MakeSegmentAfterNWrites = 2000 SamplePhase = 0 } \n", char(outsignals{i}{1}),char(outsignals{i}{5})); + fprintf("%s = { NodeName =""template.outputs.%s"" Period = MDSW0PERIOD AutomaticSegmentation = 0 MakeSegmentAfterNWrites = 2000 SamplePhase = 0 } \n", char(outsignals{i}{1}),char(outsignals{i}{5})); end diary off @@ -104,4 +106,5 @@ system(sprintf('sed -i "s/>WAVEGEN0_ELEMS</%d/g" algo_template.cfg',wg0dim)); system(sprintf('sed -i "s/MDSSRCSHOT/%d/g" algo_template.cfg',mdssrcshot)); system(sprintf('sed -i "s/MDSDSTSHOT/%d/g" algo_template.cfg',mdsdstshot)); system(sprintf('sed -i "s/VERBOSITY/%d/g" algo_template.cfg',verbosity)); +system(sprintf('sed -i "s/MDSW0PERIOD/%d/g" algo_template.cfg',mdsperiod)); diff --git a/algos/template/marte2cfg/data_states.cfgsrc b/algos/template/marte2cfg/data_states.cfgsrc index 9e567dadc0ada0a62a60666636bf6d7aa39aa960..e8cc19a1c600a30a2e2cc49b50dcce71ea78715a 100644 --- a/algos/template/marte2cfg/data_states.cfgsrc +++ b/algos/template/marte2cfg/data_states.cfgsrc @@ -29,21 +29,23 @@ NumberOfPreTriggers = 0 //Compulsory iff StoreOnTrigger = 1. Number of cycles to store before the trigger. NumberOfPostTriggers = 0 //Compulsory iff StoreOnTrigger = 1. Number of cycles to store after the trigger. Signals = { - /* + + /* Trigger = { //Compulsory when StoreOnTrigger = 1. Must be set in index 0 of the Signals node. When the value of this signal is 1 data will be stored. Type = uint8 //Type must be uint8 } + Time = { //Compulsory when StoreOnTrigger = 1. Can be store in any index, but TimeSignal must be set = 1 Type = uint32 //Type must be uint32 or int32 TimeSignal = 1 //When set, this signal will be considered as the time source against which all signals will be stored. - TimeSignalMultiplier = 1e-9 //Default = 1e-6. Multiplier to convert the time signal units into seconds, + TimeSignalMultiplier = 1e-6 //Default = 1e-6. Multiplier to convert the time signal units into seconds, } */ - - Thread1_Cycletime = { NodeName = "template.system.CH01" Period = 1 AutomaticSegmentation = 0 MakeSegmentAfterNWrites = 2000 SamplePhase = 0 } - GAMSimulink1_ReadTime = { NodeName = "template.system.CH02" Period = 1 AutomaticSegmentation = 0 MakeSegmentAfterNWrites = 2000 SamplePhase = 0 } - GAMSimulink1_ExecTime = { NodeName = "template.system.CH03" Period = 1 AutomaticSegmentation = 0 MakeSegmentAfterNWrites = 2000 SamplePhase = 0 } - GAMSimulink1_WriteTime = { NodeName = "template.system.CH04" Period = 1 AutomaticSegmentation = 0 MakeSegmentAfterNWrites = 2000 SamplePhase = 0 } + + Thread1_Cycletime = { NodeName = "template.system.CH01" Period = MDSW0PERIOD AutomaticSegmentation = 0 MakeSegmentAfterNWrites = 2000 SamplePhase = 0 } + GAMSimulink1_ReadTime = { NodeName = "template.system.CH02" Period = MDSW0PERIOD AutomaticSegmentation = 0 MakeSegmentAfterNWrites = 2000 SamplePhase = 0 } + GAMSimulink1_ExecTime = { NodeName = "template.system.CH03" Period = MDSW0PERIOD AutomaticSegmentation = 0 MakeSegmentAfterNWrites = 2000 SamplePhase = 0 } + GAMSimulink1_WriteTime = { NodeName = "template.system.CH04" Period = MDSW0PERIOD AutomaticSegmentation = 0 MakeSegmentAfterNWrites = 2000 SamplePhase = 0 } >OUTPUTBUSMDSWRITER< } @@ -82,7 +84,8 @@ Class = RealTimeThread CPUs = 0x4 Functions = { - GAMTimer + GAMTimer + TimeConversion Constants Wavegen0TimeBroker Wavegen0DataBroker diff --git a/algos/template/marte2cfg/rtapp-postsl.cfgsrc b/algos/template/marte2cfg/rtapp-postsl.cfgsrc index 0a9a1f99a41f03d0a640f1598bd9350aed2bf82e..5d566019b27adf2aa73c9428dd7bcef50fa468f8 100644 --- a/algos/template/marte2cfg/rtapp-postsl.cfgsrc +++ b/algos/template/marte2cfg/rtapp-postsl.cfgsrc @@ -1,6 +1,8 @@ +StorageBroker = { Class = IOGAM - InputSignals = { + InputSignals = { + //Trigger = { DataSource = DDB1 Type = uint8 } + //Time = { DataSource = DDB1 Type = uint32 } Thread1_CycleTime = { DataSource = Timings Type = uint32 Alias = State1.Thread1_CycleTime } GAMSimulink1_ReadTime = { DataSource = Timings Type = uint32 } GAMSimulink1_ExecTime = { DataSource = Timings Type = uint32 } @@ -8,6 +10,8 @@ >OUTPUTBUSFLAT< } OutputSignals = { + //Trigger = { DataSource = MDSWriter_0 Type = uint8 } + //Time = { DataSource = MDSWriter_0 Type = uint32 } Thread1_Cycletime = { DataSource = MDSWriter_0 Type = uint32 } GAMSimulink1_ReadTime = { DataSource = MDSWriter_0 Type = uint32 } GAMSimulink1_ExecTime = { DataSource = MDSWriter_0 Type = uint32 } diff --git a/algos/template/marte2cfg/rtapp-presl.cfgsrc b/algos/template/marte2cfg/rtapp-presl.cfgsrc index 7d0085facd608883eee1669ff79285ced0b03201..81e324d88991760e8d17c3cd0e4fa96cfb832231 100644 --- a/algos/template/marte2cfg/rtapp-presl.cfgsrc +++ b/algos/template/marte2cfg/rtapp-presl.cfgsrc @@ -12,11 +12,21 @@ $TestApp = { Counter = { DataSource = DDB1 Type = uint32 } Time = { DataSource = DDB1 Type = uint32 } } + } + +TimeConversion = { + Class = ConversionGAM + InputSignals = { + Time = { DataSource = DDB1 Type = uint32 } + } + OutputSignals = { + TimeSec = { DataSource = DDB1 Type = float32 Gain = 0.000001 } + } } +Constants = { Class = ConstantGAM OutputSignals = { zero = { DataSource = DDB1 Type = float32 NumberOfElements = 1 NumberOfDimensions=0 Default=0 } + Trigger = { DataSource = DDB1 Type = uint8 NumberOfElements = 1 NumberOfDimensions=0 Default=1 } } } +Wavegen0TimeBroker = { diff --git a/algos/template/marte2cfg/rtapp-simulinkwrapper.cfgsrc b/algos/template/marte2cfg/rtapp-simulinkwrapper.cfgsrc index 7239fec5196670934de12e9e582491f8130345b5..bda9fd5ac0c7c5907d18853d5ff7f2ec085a395e 100644 --- a/algos/template/marte2cfg/rtapp-simulinkwrapper.cfgsrc +++ b/algos/template/marte2cfg/rtapp-simulinkwrapper.cfgsrc @@ -10,7 +10,7 @@ NonVirtualBusMode = "Structured" InputSignals = { - realtime = { DataSource = DDB1 Type = float32 NumberOfElements = 1 NumberOfDimensions=0 Alias = zero } + realtime = { DataSource = DDB1 Type = float32 NumberOfElements = 1 NumberOfDimensions=0 Alias = TimeSec } >INPUTBUSSTRUCT< } OutputSignals = {