Identical blocks in Simulink with identical inputs from different sources results in different solutions
4 次查看(过去 30 天)
显示 更早的评论
While debugging a model-based controller on a system, I came across the following situation:
I have two identical blocks, each defining a nonlinear, 2nd order continuous system model (it's a pendulum) xdot = f(x,u). The blocks output xdot, which is hooked to an integrator that is looped back around so that the next simulation step can get the updated state x in f(x,u). However, one block gets u = u1 from the controller output, and one gets it from a "Repeating Sequence Stair" block that contains the same command to the plant, u = u2, that the controller outputs (saved from a previous simulation). I've output the inputs to each block and shown definitively that u1 = u2, so as far as I can tell, the systems should be identical; they just get their inputs from different sources.
However, that's not true; instead, the solutions are completely different. I'm using a fixed time-step with a Runge-Kutta (ode4) solver. I've tried other solvers and it doesn't seem to affect the result. I'd really like to know how this is possible.
See this picture http://tinypic.com/r/33n9c0o/6 in lieu of the actual model. The plant input sources are in red, the blocks containing continuous model definitions are in blue, and the states/integrators corresponding to continuous model are in green (so the conflicting outputs are Position and Position1). There's a lot of other stuff but it's also all identical between the blocks and related to the discrete models anyway (i.e. not this issue).
0 个评论
回答(2 个)
Guy Rouleau
2013-3-6
Are the colors in your image sample time colors? If yes, do you have the same response using ode1 solver?
If ode1 solver gives same response, then use this central submission to understand the effect of minor steps:
Another you might want to try is reduce the step size of the fixed-step solver to ensure the dynamics of your system is slower than the solver step size.
0 个评论
Hannes
2013-3-7
1 个评论
Guy Rouleau
2013-3-8
My main concern was that you model was mixing continuous sample with "fastest disctere(D1)" at the same rate. This can lead to oscillations in the minor steps. But if the phenomenon you observe still appear with ode1, then we rule that out because ode1 does not have minor steps.
With the information provided, I am running out of idea...
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 General Applications 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!