simscape model block performance
조회 수: 1(최근 30일)
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;%
P == i*v*(0.5 + 0.5*sqrt(1-4*esr*v*i/ocv^2));%
P == i*ocv + i*i*esr;%