Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
classdef SCDclass_mdswg < matlab.mixin.Heterogeneous
% Superclass for MDS+ wavegens
% the superclass matlab.mixin.Heterogeneous allows
% building of lists of mixed kind parameters in the
% expcode configuration (and later in C++ code)
%properties (Access = protected)
properties
mdsserver % The MDS+ server hosting the parameter
mdstree % The MDS+ Tree hosting the parameter
tdiexpr % TDI expression to retrieve data
wavegenbasestruct % Wavegen base structure hosting the wavegen toimeseries struct
wavegentarget % Wavegen target to be filled
value % commandile output of the wavegen
datadictionary % data dictionary hosting the parameter, if empty base workspace
modelname % name of the Simulink model using the parameter
getcommand % full command for getting the value (callable by matlab eval)
classname % class name for logging
timebasestart % timebase start time variable
timebasedt % timebase dt variable
timebasestop % timebase stop time variable
end
properties
verbose % Verbosity of the class
end
methods
%function obj=SCDclass_mdswavegen(srcsrv, srctree, srctdi, modelname, destwavegen, timebasestart, timebasedt, timebasestop)
function obj=SCDclass_mdswg(srctdi, destwavegen, varargin)
% MDS source and model destination constructor
p=inputParser;
addRequired(p,'srctdi',@(x) ischar(x));
addRequired(p,'destwavegen',@(x) ischar(x));
addParameter(p,'srcsrv','tcvdata',@(x) ischar(x));
addParameter(p,'srctree','tcv_shot',@(x) ischar(x));
addParameter(p,'modelname','',@(x) ischar(x));
% From subclasses constructors, unused here
addParameter(p,'destinterval',0);
addParameter(p,'destindex',0);
parse(p,srctdi,destwavegen,varargin{:}{:});
obj.mdsserver=p.Results.srcsrv;
obj.mdstree=p.Results.srctree;
obj.tdiexpr=p.Results.srctdi;
obj.wavegentarget=p.Results.destwavegen;
obj.modelname=p.Results.modelname;
obj.verbose=1;
obj.wavegenbasestruct='';
end
end
% Not abstract methods common to all child classes
methods
function mdsconnect(obj, shot)
mdsconnect(obj.mdsserver);
s=mdsopen(obj.mdstree, shot);
str=sprintf('SCDclass_mdswavegen (%s), failed opening MDS+ tree', obj.wavegentarget);
assert(s==shot, str);
end
function printinfocommon(obj)
fprintf('%s (class %s):\n', obj.gettargetwavegen, obj.classname);
fprintf(' Simulink model: ''%s''\n', obj.modelname);
fprintf(' MDS+ source server: ''%s'', Tree: ''%s''\n', obj.mdsserver, obj.mdstree);
fprintf(' MDS+ TDI expression: ''%s''\n',obj.tdiexpr);
end
function obj = settiminginfo(obj, timeinfo)
obj.timebasestart=timeinfo.t_start;
obj.timebasedt=timeinfo.dt;
obj.timebasestop=timeinfo.t_stop;
end
function obj = setmodelname(obj, modelname)
if(isempty(obj.modelname))
obj.modelname = modelname;
end
end
function obj = setdatadictionary(obj, ddname)
if(isempty(obj.datadictionary))
obj.datadictionary = ddname;
end
end
function obj = setbasestruct(obj, basestruct)
obj.wavegenbasestruct = basestruct;
end
%function out = gettargetparam(obj)
% out = obj.modelparam;
%end
function entrystring = genMARTe2entrycommon(obj, shot)
%obj.mdsconnect(shot);
%[obj,~]=obj.getdata;
%entrystring = ['+' obj.wavegentarget ' = { Class=' obj.classname ' Path=' obj.tdiexpr ' }'];
entrystring = ['+' obj.wavegentarget ' = { Class=' obj.classname ' Path=' obj.tdiexpr ];
end
end
% Abstract method actually implemented by child classes
methods (Abstract)
% Gets data from MDS+ and actualizes it on the model,
% MDS+ connection is reopened for every call ...
actualizedata(obj, shot)
% Gets data from mds, mds connection is assumed already estabilished
% and tree opened
value = getdata(obj)
% Gets a string containing the target wavegen of the model
out = gettargetwavegen(obj)
% Generate C++ code
%gencode(obj)
% Prints the parameter info summary
printinfo(obj)
end
end