Fixed-step solvers, model referencing and Normal and Accelerator mode
显示 更早的评论
Dear all,
I'm designing a Simulink model to simulate the dynamics of a vehicle. My model is composed by a system "VehicleDynamics" which contains two referenced models "WheelDynamics" (4 instances) and "LocalController" (4 instances). The model "WheelDynamics" include a continuous-time state, while the model "LocalController" just include some gains and switches, but it takes the wheel speed as an input signal and it generates a continuous-time output. My model "VehicleDynamics" runs in normal mode, the model "WheelDynmaicsFL" (FL stands for front-left) runs also in Normal mode, while the other three instances "WheelDynmaicsXX" (where XX is FR,RL,RR) run in Accelerator mode. The same is for the four instances of "LocalControllerXX": "LocalControllerFL" runs in Normal Mode, while the other three instances of the same model runs in Accelerator mode. Until here, everything works fine as long as I use a variable-step solver. If I use a fixed-step solver (like for example ode3 (Bogacki-Shampine)), I get this error:
"The Model block cannot inherit a continuous sample time. Output port 1 of Model block 'SingleWheelTEST/LocalCtrlFL' cannot accept 'continuous' sample time."
To get a better understanding of the system, I made a model with just one instance of "WheelDynamics" and "LocalController" that run in Normal mode. With the fixed step solver I still experience the same error, while with the variable-step solver everything goes smooth, and I cannot understand why!
I already tried to configure all the models in question "SingleWheelTEST", "WheelDynamics" and "LocalController" to use a Fixed-Step solver, but it didn't worked out.
Fianlly, having 4 instances of "WheelDynamics" and "LocalController", it seems that I'm constrainted to use Accelerator mode on 3 of the instances. However, I don't want to use them because Simulink generates code in the working folder that put additional files that I will never open (it creates like a "slprj" foldes and several .mexw32 files that I don't want). Is it possible to use all in Normal mode instead?
The Matlab version I'm using is the 2009a.
Thanks,
Ubaldo
采纳的回答
更多回答(4 个)
K E
2012-4-19
0 个投票
I likely misunderstand your question, but I think you need SimScape if you want both continuous and discrete time sampling schemes within the same model. There is a specific block to interface between continuous and discrete sampling but I can't remember the name (just remembering from training, but haven't done it myself).
Kaustubha Govind
2012-4-19
0 个投票
Ubaldo: I already answered the second part of your question here. You need to use R2010b or later to have multiple instances of a referenced model in Normal mode. There is no workaround for older versions, unfortunately.
For the first part, I still can't imagine why the error occurs on changing just the Solver Type. If the first output port of the model being referenced at "SingleWheelTEST/LocalCtrlFL" really returning a continuous sample-time with a fixed-step solver? What is its sample time with a variable-step solver when there is no error?
Ubaldo Tiberi
2012-4-20
0 个投票
3 个评论
Kaustubha Govind
2012-4-20
Simulink.Block.getSampleTimes will not work, because it attempts to compile the model (equivalent to running Ctrl+D on your model), which is where you run into the error.
What sample-times does the model 'SingleWheelTEST' contain when you pick a fixed-step solver? How are these different from when you pick a variable-step solver? FYI, you can turn on sample time annotations by following the instructions here: http://blogs.mathworks.com/seth/2008/10/24/r2008b-simulink-sample-time-colors/
Ubaldo Tiberi
2012-4-23
Kaustubha Govind
2012-4-24
Ubaldo: Even if you left it as auto, the sample time annotations will show you the actual (compiled) sample time being used for the model. My question was about the compiled sample times.
Ubaldo Tiberi
2012-4-25
0 个投票
1 个评论
Kaustubha Govind
2012-4-25
It looks like 'SingleWheelTEST/LocalCtrlFL' is getting a discrete sample-time - what kind of source blocks do you have in this model? Do any of them have "-1" as their sample time? If yes, try setting them to "0" and see if 'SingleWheelTEST/LocalCtrlFL' gets a Continuous sample-time with the Fixed-step solver as well.
类别
在 帮助中心 和 File Exchange 中查找有关 Component-Based Modeling 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!