Why doesn't my sample time change?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Stellan Johansson
am 28 Nov. 2017
Beantwortet: Sebastian Castro
am 26 Jan. 2018
Hello,
I have been given a Simulink model using a sample time of 0.1s. I want to add an S-function (.mexw64) that requires a sample time of 0.01s. However, trying to change the solver sample time to 0.01s doesn't seem to work. I get the following error:
The sample time period (0.01) of 'model block x' is not an integer multiple of the fixed step size (0.1) specified for model.
The error occurs for several model blocks, x, y, z, etc... In the model explorer, all configurations have the same sample times, 0.01s, but the error persists. I have found no program lines that change the sample time during excecution. Is there something I have missed?
BR Stellan
0 Kommentare
Akzeptierte Antwort
Sebastian Castro
am 26 Jan. 2018
If you go to Simulation > Model Configuration Parameters, the "Solver" pane should have a sample time setting in there set to 0.1. The error you're getting is because the solver is running at a fixed step size of 0.1 second, but you're trying to go faster with certain blocks in the model.
You can either reduce that to a smaller value that will work, or if you plan to define sample times in blocks, just set it to "auto" and the model will choose a sample time based on the blocks.
Even better, create a MATLAB variable for sample time and use it both in the solver settings and your blocks. That way, you just change that value and everything in the model updates accordingly.
- Sebastian
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu General Applications finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!