Skip to content
Snippets Groups Projects
Commit 32adf946 authored by Cristian Galperti's avatar Cristian Galperti
Browse files

First commit of SCD v2018b on git

parents
No related branches found
No related tags found
No related merge requests found
function [] = SCDconf_createexpcodes()
%% The expcode container,
% it contains a list of expcode numbers and function pointers
% to the corresponding object builder functions,
% we chose not to insert the object itself in the container
% since we do not want to call external code w.r.t. the in use
% expcode (comprising its defining code).
% Not that the printexpcodes method calls all the builder
% in sequence, printing out which ones are generating errors.
SCDexps=SCDclass_expcodecontainer;
SCDexps=SCDexps.insertexpcode(1, @(x) SCDexpcodeconf_template);
SCDexps=SCDexps.insertexpcode(1005, @(x) SCDexpcodeconf_tcvstandard02);
assignin('base','SCDexps',SCDexps);
end
% This function helps creating template simulation input structures
% for From Workspaces blocks feeding bus signals
% Called with a Simulink.Bus object as an input it creates
% a template struct of timeseries filled with 2 timepoints [0,1]
% and with zero data of the correct kind
% This is enough for passing a ctrl-D with from Workspace bus kind blocks
function [out] = SCDconf_createsimdatastruct(bus)
bussize=size(bus.Elements);
signalssize=bussize(1);
tempstruct=struct();
for ii=1:signalssize
elementdim=bus.Elements(ii).Dimensions;
switch numel(elementdim)
case 1,
data=zeros(elementdim(1),2)';
case 2,
data=zeros(elementdim(1),elementdim(2),2);
otherwise,
error('Not supported data structure');
end
tscmd=sprintf('tmpts=timeseries(%s(data),[0;1]);',bus.Elements(ii).DataType);
eval(tscmd);
structcmd=sprintf('tempstruct.%s=tmpts;',bus.Elements(ii).Name);
eval(structcmd);
end
out=tempstruct;
%out=Simulink.SimulationData.createStructOfTimeseries(bus,tempstruct)
\ No newline at end of file
% Gets tcv data dictionary design data as a object in base workspace
function [out] = SCDconf_getdatadict(varargin)
if nargin==0
d=Simulink.data.dictionary.open('tcv.sldd');
dd=getSection(d, 'Design Data');
out=dd;
elseif nargin==1
d=Simulink.data.dictionary.open(varargin{1});
dd=getSection(d, 'Design Data');
out=dd;
else
error('Too many input params');
end
\ No newline at end of file
%% SYSTLC: Embedded Coder (host-based shared library target) TMF: ert_default_tmf MAKE: make_rtw \
%% EXTMODE: ext_comm
%%
%%
%%
%%
%% Copyright 2006-2010 The MathWorks, Inc.
%% Abstract: Embedded real-time system target file for shared library generation.
%%
%selectfile NULL_FILE
%assign CodeFormat = "Embedded-C"
%assign TargetType = "RT"
%assign Language = "C"
%assign AutoBuildProcedure = !GenerateSampleERTMain
%include "codegenentry.tlc"
%% Error out on incompatible options
%if (ExtMode != 0)
%assign errTxt = "External mode is not supported by the Embedded Coder shared library target."
%<LibReportError(errTxt)>
%endif
%if (CompiledModel.NumAsynchronousSampleTimes > 0)
%assign warnTxt = "Asynchronous functions are not supported by the Embedded Coder shared library target."
%<LibReportWarning(warnTxt)>
%endif
%% generate export symbol description files.
%include "export_shrlib_def_scd.tlc"
%%include "export_shrlib.tlc"
%% The contents between 'BEGIN_RTW_OPTIONS' and 'END_RTW_OPTIONS' in this file
%% are used to maintain backward compatibility to R13 and preR13 custom target
%% file only. If you want to use this file as a template to develop your
%% own system target file, you need to remove the 'CONFIGSET_TARGET_COMPONENT'
%% section at the end of this file.
%%
/%
BEGIN_RTW_OPTIONS
%
%----------------------------------------%
% Configure code generation settings %
%----------------------------------------%
rtwgensettings.DerivedFrom = 'ert.tlc';
rtwgensettings.BuildDirSuffix = '_ert_shrlib_rtw';
rtwgensettings.Version = '1'; % Specify callbacks' compliance with DAStudio dialog
rtwgensettings.SelectCallback = ['ert_shrlib_callback_handler(hDlg, hSrc)'];
END_RTW_OPTIONS
%/
This diff is collapsed.
%% =======================================================================
%% File: export_shrlib_def.tlc
%%
%% Abstract: Create module definition file <model>.def for DLL export on
%% Windows OS Create version script symbol map file for Unix OS
%%
%%
%% Copyright 2006-2011 The MathWorks, Inc.
%% ======================================================================
%selectfile NULL_FILE
%if EXISTS("_EXPDLLDEF_") == 0
%assign _EXPDLLDEF_ = 1
%with ::CompiledModel
%% Define file extension
%assign fileExtension="def"
%assign expfileName = "%<Name>.%<fileExtension>"
%% Define leading underscore for MAC OS
%if FEVAL("ismac") == TLC_TRUE
%assign leadingUs="_"
%else
%assign leadingUs=""
%endif
%% Define trailing semicolon for UNIX non-MAC OS
%if FEVAL("isunix")==TLC_TRUE && FEVAL("ismac")==TLC_FALSE
%assign trailingSc=";"
%else
%assign trailingSc=""
%endif
%%=========================================================================
%% Function: ExportModelStepSymbols(tid)
%% This function lists the step function symbols to be exported to DLL
%%
%%=========================================================================
%function ExportModelStepSymbols(tid) void
%openfile tmpFcnBuf
%if GenerateSampleERTMain && SLibIsAsyncTaskOnlyModel()
%% step function is empty, does not exist.
%return
%endif
%if CombineOutputUpdateFcns
%<leadingUs>%<SLibModelStepFcnName(tid)>%<trailingSc>\
%else
%<leadingUs>%<FcnGetModelOutputFcnNameFromCoderDictionary(tid)>%<trailingSc>
%<leadingUs>%<FcnGetModelUpdateFcnNameFromCoderDictionary(tid)>%<trailingSc>\
%endif
%closefile tmpFcnBuf
%return tmpFcnBuf
%endfunction %% ExportModelStepSymbols(tid)
%%=========================================================================
%% Function: ExportGlobalSignalSymbols
%% Abstract:
%% Export global signals
%%
%%=========================================================================
%function ExportGlobalSignalSymbols() void
%if ::CompiledModel.NumExportedGlobalSignals > 0
%openfile tmpFcnBuffer
%% external root inport signals
%if ExternalInputs.NumExportedGlobalSignals > 0
%foreach idx = ExternalInputs.NumExternalInputs
%assign extInp = ExternalInputs.ExternalInput[idx]
%if extInp.StorageClass == "ExportedGlobal"
%<leadingUs>%<LibGetRecordIdentifier(extInp)>%<trailingSc>
%endif
%endforeach
%endif
%% external block io signals
%if BlockOutputs.NumExportedGlobalSignals > 0
%foreach boIdx = BlockOutputs.NumExternalBlockOutputs
%assign bo = BlockOutputs.ExternalBlockOutput[boIdx]
%if bo.StorageClass == "ExportedGlobal"
%<leadingUs>%<LibGetRecordIdentifier(bo)>%<trailingSc>
%endif
%endforeach
%endif
%closefile tmpFcnBuffer
%return tmpFcnBuffer
%endif
%endfunction %% ExportGlobalSignalSymbols
%%=========================================================================
%% Function: ExportTunableParamSymbols
%% Abstract:
%% Export tunable parameters
%%
%%=========================================================================
%function ExportTunableParamSymbols() void
%with ::CompiledModel.ModelParameters
%if NumParameters > 0
%openfile tmpFcnBuffer
%foreach idx = NumParameters
%assign extParam = Parameter[idx]
%if extParam.StorageClass == "ExportedGlobal"
%<leadingUs>%<LibGetRecordIdentifier(extParam)>%<trailingSc>
%endif
%endforeach
%if !LibParametersStructIsEmpty()
%<leadingUs>%<LibGetParametersStruct()>%<trailingSc>
%endif
%closefile tmpFcnBuffer
%return tmpFcnBuffer
%endif
%endwith
%endfunction %% ExportTunableParamSymbols
%%==================================================================
%% writing .def file
%%
%%==================================================================
%openfile exportdefId = "%<expfileName>", "w"
%if FEVAL("ispc")==TLC_TRUE
EXPORTS
%elseif FEVAL("ismac")==TLC_TRUE
%else
{
global:
%endif
%if (!EmptyRealTimeObject) && (!MultiInstanceERTCode)
%<leadingUs>%<::tSimStruct>_%<trailingSc>
%<leadingUs>%<::tSimStruct>%<trailingSc>
%endif
%if !LibExternalInputsStructIsEmpty() && (!MultiInstanceERTCode)
%<leadingUs>%<LibGetExternalInputStruct()>%<trailingSc>
%endif
%if !LibExternalOutputsStructIsEmpty() && (!MultiInstanceERTCode)
%<leadingUs>%<LibGetExternalOutputStruct()>%<trailingSc>
%endif
%assign mdlRef = IsModelReferenceTarget()
%assign multiOrMdlref = MultiInstanceERTCode || mdlRef
%if !multiOrMdlref && ::CompiledModel.NumCoderDataGroups > 0
%foreach idx = ::CompiledModel.NumCoderDataGroups
%assign group = ::CompiledModel.CoderDataGroup[idx]
%if !SLibCoderDataGroupIsImported(group)
%assign numVars = SLibCoderDataGroupNumElements(group)
%if numVars > 0
%foreach idx = numVars
%<leadingUs>%<SLibCoderDataGroupElementInstance(group, idx)>%<trailingSc>
%endforeach
%endif
%endif
%endforeach
%endif
%<leadingUs>%<GenerateModelInitFcnName()>%<trailingSc>
%if (SLibSingleTasking() || (!SLibSingleTasking() && !GenerateSampleERTMain))&& !SLibIsAsyncTaskOnlyModel()
%if CombineOutputUpdateFcns
%<leadingUs>%<SLibModelStepFcnName("")>%<trailingSc>
%else
%<leadingUs>%<FcnGetModelOutputFcnNameFromCoderDictionary("")>%<trailingSc>
%<leadingUs>%<FcnGetModelUpdateFcnNameFromCoderDictionary("")>%<trailingSc>
%endif
%endif
%if !SLibSingleTasking()
%if SLibHasSetEventsForThisBaseRateFcn()
%<leadingUs>%<Name>_SetEventsForThisBaseStep%<trailingSc>
%endif
%% Call the step function for the base rate
%<ExportModelStepSymbols(0)>
%if LibGetNumSyncPeriodicTasks() > 2
%% Multiple subrates
%%for (i = %<1+tid01Eq>; i < %<FcnNumST()>; i++) {
%foreach tid = %<FcnNumST()>
%if tid >= 1+FixedStepOpts.TID01EQ
%<ExportModelStepSymbols(tid)>
%endif
%endforeach
%else
%% Single subrate
%assign tid = FcnNumST()-1
%<ExportModelStepSymbols(tid)>
%endif
%endif
%if IncludeMdlTerminateFcn
%<leadingUs>%<Name>_terminate%<trailingSc>
%endif
%% If MatFileLogging is ON, export rt_StopDataLogging symbol. Additionally,
%% export rt_UpdateTXYLogVars symbol if CombineOutputUpdateFcns is OFF.
%if MatFileLogging
%if !::IncludeLoggingInstrumentation
%<leadingUs>rt_UpdateTXYLogVars%<trailingSc>
%endif
%<leadingUs>rt_StopDataLogging%<trailingSc>
%endif
%if (!MultiInstanceERTCode)
%<ExportGlobalSignalSymbols()>\
%<ExportTunableParamSymbols()>\
%endif
%if ::RTWCAPI==1
%<leadingUs>%<Name>_GetCAPIStaticMap%<trailingSc>
%endif
%if FEVAL("isunix")==TLC_TRUE && FEVAL("ismac")==TLC_FALSE
mydef;
local:
*;
};
%endif
%closefile exportdefId
%endwith
%endif %% _EXPDLLDEF_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment