LabVIEWConnector
GenerateCode
Generate LabVIEW EMI or NI VeriStand and LabVIEW SIT Component C Code
Calling Sequence
Parameters
Returns
Options
Description
GenerateCode(system, options)
system
-
`module` ; Msim model
options
(optional) equation(s) of the form name = value
none
target : one of the following: "EMI", "SIT"
Specifies the target platform for which the code will be generated. Default is "EMI".
name : string
Specifies the filename of the generated C file. Default is "MsimModel".
outputdir : string
Specifies the output directory for generated files. Default is "kernelopts('homedir')".
pathEnvironment : string
Specifies the path to the EMI or SIT installation directory. Default is "C:/Program Files (x86)/National Instruments/LabVIEW 2012".
pathVC : string
Specifies the path to the Visual C++ installation directory. Default is "C:/Program Files (x86)/Microsoft Visual Studio/2017/WDExpress/VC".
initial : set of equations
Specifies the initial conditions for all system's states, ix1 variables, and inputs.
inputs : list of functions
Specifies system's input variables.
outputs : list of functions
Specifies system's output variables.
params : list of equations
Specifies values of system's parameters.
nosubs : true or false
Specifies whether the parameters are entered as the original model names or the substituted names. Default is false.
optimize : one of the following: false, "subexpronly", "fast", true
Specifies level of code optimization (false = None, true = Full). Default is "subexpronly".
coniter : non negative integer
Specifies constraint iteration count. Default is 20.
contol : positive
Specifies constraint tolerance. Default is 1e-7.
evtiter : positive integer
Specifies maximum number of event iterations. Default is 10.
evtproj : true or false
Specifies use projection in events. Default is true.
evthyst : non negative
Specifies width of event hysteresis band. Default is 1e-10.
fixedstep : true or false
Specifies whether to optimize for use with fixed-step integrators. Default is false. fixedstep must be true when target = "SIT".
diagnosticinfo = true or false
This option only suported when target option is set to "EMI". This option specifies whether to provide run-time diagnostics in the generated EMI block.
When specified as true, engine will add two outputs to the bottom of the EMI block, EventIterations(t) and ConstraintIterations(t), in that order.
Note that if the EMI inputs/outputs are grouped into vectors, these outputs will be placed in the group DiagnosticInfo.
This option will be available for both, EMI fixed-step integrators, and for EMI variable-step integrators, and in the latter case, will report on the maximum of the value obtained since the last output point.
Default is false.
discretize = true or false
Specifies whether to export as a discrete model (no continuous states). Default is false.
solver = one of the following: "Euler", "RK2", "RK3", "RK4", "ImplicitEuler"
If target option above is set to "EMI" and discretize option above is set to true, specifies which external solver to be included in the exported discrete model. Default is "Euler".
timestep = non negative
If target option above is set to "EMI" and discretize option above is set to true, specifies the exported model's discrete timestep. Default is 1e-3.
inpnumdiff : true or false
Specifies whether to use numeric derivatives for inputs. Default is false.
addoutputs : one of the following: "none", "states", "statevals", "continuous", "all"
Specifies which additional variables need to be included in outputs. Default is "none".
optionsSIT : list: [nonnegative, {"internal", "external", "internal&external"}]
Specifies [baserate, inputTypes]. baserate is the rate at which the model will run. inputTypes specifies type of inputs: internal, external or both. Default is [0.001,"internal&external"]. When target is set to "EMI", optionsSIT option is ignored.
The GenerateCode command generates LabVIEW EMI or NI VeriStand and LabVIEW SIT component code from a MapleSim system.
See Also
LabVIEWConnector[CompileCode]
MapleSim
Download Help Document
What kind of issue would you like to report? (Optional)