Identical blocks in Simulink with identical inputs from different sources results in different solutions
조회 수: 3 (최근 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!