Simulink and Matlab's sim command give different results

조회 수: 6 (최근 30일)
Dimosthenis Michaloudis
Dimosthenis Michaloudis 2023년 9월 18일
댓글: Dimosthenis Michaloudis 2023년 9월 21일
Hello,
I am using a Matlab code in order to simulate a Simulink power system. To specify, the code runs the first data (each data originates from a table and represents a neighboorhood's load needs), simulates, loops back, refreshes the data (new row in table), simulates, and so on.
There are also some variables that sum up the load needs from the data, and some variables that sum up the power system's actual generation. For example the first will show that a load of 100 kW is requested. The actual generation might be 100,3 kW.
When I run the system straight from Simulink, it runs perfectly. The results are optimal, as well as the scopes.
When I run the system through Matlab though, some vast differences come into play. The variables are way off, for example the total load requested is 100.000 kW, but the actual generation is 100.000.000 kW. The scopes are somewhat closer, but I believe that they can be fixed with Operating Set Points.
Any ideas on how to fix my problem? Essentially it's the same system, but the results are different.

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 9월 18일
It should not happen unless there are inconsistencies with the input variables and output variable settings.
(1) What you are reading in MATLAB might be a part of the simulation and not a whole simulation. Carefully set up what results you're importing into MATLAB workspace. For example, for data export via Scope, check Scope -> Configuration Properties: Scope -> Logging.
(2) Check what variable values are to be read from MATLAB workspace if it is executed from MATLAB.
(3) A problem with value entries: 100 kW = 100e3 W. One may overlook and enter 100 instead or vice versa.
  댓글 수: 1
Dimosthenis Michaloudis
Dimosthenis Michaloudis 2023년 9월 21일
Hello,
I already checked Logging, and the variables are correct, as well as their entries. That's the main reason I cannot understand why the results are so off. I asked for Mathworks tech support and they just dodged me.

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

카테고리

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

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by