simscape model block performance

조회 수: 2 (최근 30일)
Albert Mathews
Albert Mathews 2016년 11월 7일
댓글: Hannes Daepp 2016년 11월 11일
I have created two versions of simscape model block. The code for each is identical except for 2 lines where some additional math steps are added. The code below shows the portion of the equations section which is changed, the longer lines are the "complex" model, and the shorter lines are the "simple" model. with everything held equal in terms of solver, host model, etc, changing the simulink model so as to change the variable i, I am noticing that as i becomes larger, the simulation time between the two simscape implementations becomes very different. For example, my tests showed that, for a total 20sec simulation:
  • i = 26, runtime was approximately 3.7sec for both models
  • i = 260, runtime was approximately 2sec for both models
  • i = 520, runtime was 3sec for the simple model, and 12sec for the "complex" model.
I did try breaking up the lines into more equations, but this made matters worse.
Is there something with using sqrt or ^2 in simscape that could cause this?
Is there another simscape implementation of complex model that wouldn't result in the slow performance at high i values?
if i > 0
P == i*v*(1.5 - 0.5*sqrt(1+4*esr*v*i/ocv^2));%
P == i*ocv;%
else
P == i*v*(0.5 + 0.5*sqrt(1-4*esr*v*i/ocv^2));%
P == i*ocv + i*i*esr;%
end
  댓글 수: 1
Hannes Daepp
Hannes Daepp 2016년 11월 11일
It is hard to determine the exact cause of the difference in performance without more information on the system, or an example model. From this simple information, you are replacing a simple system with a more complex one and it takes longer; that behavior is not unexpected by itself. Furthermore, these equations scale with i, so one would expect any difference to be exacerbated as i increases in value.
However, it is important to understand that Simscape systems are handled differently than regular Simulink systems. In Simscape, the "==" operator is used to represent continuous mathematical equality, which is not synonymous with assignment, i.e. the equations are not solved sequentially. In other words, using multiple equations would not simplify your system; it would just replace a single equation with a system of equations.
You can find more information on how Simscape language solves equations in the documentation: https://www.mathworks.com/help/physmod/simscape/lang/defining-component-equations.html#brn4h9l-3

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Troubleshooting에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by