Simulink model generate different results with tha same parameters
30 次查看(过去 30 天)
显示 更早的评论
I built a Simulink induction motor with ITSC fault model and tried to simulate it. I configured the necessary parameters in Model Properties——Callbacks——InitFcn. With the same parameters, I get the different simulation results first time and second time, but after the first time, the results are the same. I'm confused, why is that? I'm pretty sure there're no random functions in my model. Below are configurations of parameters and simulation results. You can tell that the transient process of the first time is shorter than the second time, and in steady state, the amplitude of ia, the yellow sine wave, is larger than other two.
0 个评论
回答(2 个)
Githin George
2024-2-8
Hello Raymond,
Upon reviewing the "InitFcn" you've shared, one of the probable reasons for the varying outcomes between the initial and later simulation runs is the sequence in which the instructions are executed. Specifically, the parameter initialization “Lls = Ls-Lm” and “Llr = Lr-Lm” happens before the value “Lm” is defined and as a result the first run has corrupted or dummy values for “Lls” and “Llr”.
The simulation should in fact error out the first time as well, since the value “Lm” is undefined, but it is not the case. A possible reason is that the value “Lm” had already been initialized in the base workspace. During the compilation phase of the first simulation, the value of “Lm” is correctly updated to 0.64 resulting the subsequent simulations to yield the correct output.
To resolve the issue, you can change the order of instructions in the “InitFcn” as shown below.
Lm = 0.64;
Llr = Lr-Lm;
Lls = Ls-Lm;
I hope this helps.
0 个评论
Poorna
2024-2-9
Hi Rayond,
I see that you are getting different results for each run of the simulation after you open a model. But the initial run results are always the same each time you open the model freshly.
It is hard to find the exact reason why this is happening without the access to the model. But, based on my experience with similar situations, one of the reasons why this could happen is when you are trying to load any parameters from a MAT file or a script before opening the model.
The parameters then would be loaded to the workspace and accessed from there. And during the first run these parameter values might be modified which will give different results for future runs.
Check if any parameters are loaded from workspace and make sure to include them in the “initFcn” callbacks.
To know more about the “initFcn” callback, please refer to the following documentation:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!