From bbca8cf9f871ed563052c80ec8327f99d5eccb17 Mon Sep 17 00:00:00 2001 From: Cristian Galperti <cristian.galperti@epfl.ch> Date: Tue, 18 Jun 2019 17:21:54 +0200 Subject: [PATCH] tcv02standard loads all cfg from MDS+, no skip p. tcv02standard loads all the cfg of hybrid + IOH + stddiag from MDS+ in MARTe2. IOH control setup time works and configured itself correctly according to G2(17,1) matrices content. This is a strong clue that the 3D G matrices are loaded with the correct alignement. All spurious tunable parameters are removed now, so we can have a strict loading. Tasks and wavegens still pending. --- code/classes/SCDclass_mdsobjcontainer.m | 10 ++--- code/classes/SCDclass_mdspar.m | 49 +++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/code/classes/SCDclass_mdsobjcontainer.m b/code/classes/SCDclass_mdsobjcontainer.m index 1f6dc24..eecc2ce 100644 --- a/code/classes/SCDclass_mdsobjcontainer.m +++ b/code/classes/SCDclass_mdsobjcontainer.m @@ -250,7 +250,7 @@ classdef SCDclass_mdsobjcontainer prevServer = ''; % init % Header for MDS for loader - loaderStr = sprintf('\n\n+MDSParameters = {\n Class=MDSObjLoader \n Shot=%d\n',shot); + loaderStr = sprintf('\n\n+MDSParameters = {\n Class=MDSObjLoader\n Shot=%d\n',shot); fprintf("%s",loaderStr); for ii=1:obj.numparams @@ -260,7 +260,7 @@ classdef SCDclass_mdsobjcontainer % generate header for MDSsource if necessary if ~strcmp(currentServer,prevServer) %if a new server needs to be opened - if ii~=1, fprintf(' }\n'), end % close bracket for previous one + if ii~=1, fprintf(' }\n'), end % close bracket for previous one % print new source header fprintf("%s\n",mymdsparam.genMARTe2MDSsourcestr); end @@ -268,15 +268,15 @@ classdef SCDclass_mdsobjcontainer % generate data source entry str = mymdsparam.genMARTe2entry(shot); - fprintf(" %s\n",str); + fprintf(" %s\n",str); end - fprintf(" }\n}\n\n"); + fprintf(" }\n}\n\n"); otherwise for ii=1:obj.numparams if(strcmp(obj.modeltogenerate,obj.mdsparams(ii).getmodelname)) str=obj.mdsparams(ii).genMARTe2entry(shot); - fprintf(" %s\n",str); + fprintf(" %s\n",str); end end end diff --git a/code/classes/SCDclass_mdspar.m b/code/classes/SCDclass_mdspar.m index 5235f76..d2bb959 100644 --- a/code/classes/SCDclass_mdspar.m +++ b/code/classes/SCDclass_mdspar.m @@ -11,7 +11,9 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous tdiexprmodel % TDI expression to retrieve data when invoked with -1 shot tdiexprshot % TDI expression to retrieve data when invoked with a give shotno, if empty the -1 is used tdiexprused % TDI expression actually used + %tdiexprmarte % TDI expression actually used converted to MARTe cfg convections modelparam % Full expansion of the model target parameter (modeltpstruct+modeltargetpar) + modelparammarte % Full expansion of the model target oarameter (modeltpstruct+modeltargetpar) with marte separators modeltpstruct % target tunable parameter structure, if left empty it will be filled once binding to an algorithm modeltargetpar % Model parameter w/o tunable parameters structure value % value of the parameter @@ -21,12 +23,17 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous classname % class name for logging marteclassname % class name for generating MARTe2 cfg file cparser % constructor parameters parser + skippable % true if the parameters loading can be skipped during the actualization process and default value used, unused for now + + matlabseparator % structure separator character used in MAtlab/Simulink + marteseparator % structure separator character used in MARTe2 assignvar % actualizedata specific assignstring % actualizedata specific denanstring % actualizedata specific caststring % actualizedata specific + end properties @@ -45,8 +52,12 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous addParameter(obj.cparser,'modelname','',@(x) ischar(x)); addParameter(obj.cparser,'datadictname','',@(x) ischar(x)); addParameter(obj.cparser,'modeltpstruct','',@(x) ischar(x)); % desttp ? - + addParameter(obj.cparser,'skippable','false',@(x) ischar(x)); + obj.verbose=1; + obj.matlabseparator='.'; + obj.marteseparator='-'; + end function obj=parseconstructorcommon(obj, srctdimodel, destparam, varargin) @@ -64,6 +75,7 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous obj.modelname=obj.cparser.Results.modelname; obj.datadictionary=obj.cparser.Results.datadictname; obj.modeltpstruct=obj.cparser.Results.modeltpstruct; + obj.skippable=obj.cparser.Results.skippable; end function name=getmodelname(obj) @@ -124,6 +136,7 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous obj.tdiexprused=obj.tdiexprshot; end obj.modelparam=[obj.modeltpstruct '.' obj.modeltargetpar]; + obj.modelparammarte = strrep(obj.modelparam, obj.matlabseparator, obj.marteseparator); end function obj=actualizetdiexpr(obj, shot) @@ -150,6 +163,10 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous out = obj.modelparam; end + function out = gettargetparammarte(obj) + out = obj.modelparammarte; + end + function [mdsserver] = getMDSserver(obj) mdsserver = obj.mdsserver; end @@ -164,6 +181,7 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous obj.modeltpstruct = structname; end obj.modelparam=[obj.modeltpstruct '.' obj.modeltargetpar]; + obj.modelparammarte = strrep(obj.modelparam, obj.matlabseparator, obj.marteseparator); end function obj = setmodelname(obj, modelname) @@ -178,16 +196,39 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous end end + end + + methods + function entrystring = genMARTe2entrycommon(obj, shot) obj=obj.actualizetdiexpr(shot); - entrystring = sprintf('+%-50s = { Class=%-30s Path=%-40s',obj.gettargetparam,obj.marteclassname,obj.tdiexprused); + %entrystring = sprintf('+%-50s = { Class=%-30s Path=%-40s',obj.gettargetparammarte,obj.marteclassname,obj.tdiexprused); + entrystring = sprintf('+%-50s = { Class=%-30s Path=%-40s',obj.gettargetparammarte,obj.marteclassname,obj.genMARTe2MDStdiexpression); + end function str = genMARTe2MDSsourcestr(obj) %str = sprintf(' +MDSSource = {\n Class=SPCMDSSource\n Server=%s\n Tree=%s',obj.mdsserver,obj.mdstree); - str = sprintf(' +Connection_%s = {\n Class=MDSObjConnection\n Tree=%s',obj.mdsserver,obj.mdstree); - + str = sprintf(' +Connection_%s_%s = {\n Class=MDSObjConnection\n Server=%s\n Tree=%s',obj.mdsserver,obj.mdstree,obj.mdsserver,obj.mdstree); end + + function str = genMARTe2MDStdiexpression(obj) + % Duplicate first backslash +% if(obj.tdiexprused(1)=='\' && not(obj.tdiexprused(2)=='\')) +% martetdi=['\' obj.tdiexprused]; +% else +% martetdi=obj.tdiexprused; +% end + % Duplicate backslashes + martetdi=strrep(obj.tdiexprused, '\', '\\'); + %substitute every " with ' + martetdi=strrep(martetdi, '"', ''''); + %put double string quota + martetdi=['"' martetdi '"']; + str=martetdi; + end + + end -- GitLab