Last active
November 5, 2015 17:27
-
-
Save summivox/327e0d2e51174b5895e9 to your computer and use it in GitHub Desktop.
Simulink Realtime: common conf + solver override
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function slrt_conf_init(conf, solver, Ts) | |
| % initialize configuration of current model with default, then override | |
| % with given solver and timestep setting | |
| % | |
| % conf: path to common configuration file | |
| % solver: 'FixedStepDiscrete', 'ode8', 'ode4', ... | |
| % Ts: fixed step time of solver | |
| % | |
| % NOTE: SLRT allows only fixed-step solvers | |
| Simulink.BlockDiagram.loadActiveConfigSet(gcs, conf); | |
| set_param(gcs ... | |
| , 'SolverType', 'Fixed-step' ... | |
| , 'Solver', solver ... | |
| , 'FixedStep', num2str(Ts, '%.6e') ... | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment