How to solve "invalid setting for parameter 'Gain' " while trying to simulate with only integral gain of a PID controller?

조회 수: 104 (최근 30일)
Hi,
I am trying to add an 'integral action' into a wind turbine model to remove steady state traking error. I only need to use the integral gain. I have used MATLAB sprict to calculate the integral gain 'Ki', and used the PID controller in the Simulink with having 'I' controller selected. When I run the simulation, It gives this error:
Error using DAC (line 251)
Invalid setting in 'DAC_si/IPC/DAC/Integral action 'Ki'/I Gain/Internal Parameters/Integral Gain' for parameter 'Gain'.
I would appriciate if anyone couldn help me on solving this. Thank you.
Best regards
  댓글 수: 3
Biplob Chowdhury
Biplob Chowdhury 2023년 7월 10일
Hello Sam,
Thank you for your reply.
I am using 'Ki' as tuneable parameter. Please have a look at the screenshot.
Best regards

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

답변 (1개)

Daniel
Daniel 2023년 7월 10일
Although there's not a lot that can be said without seeing the actual model and script involved, the error "Invalid setting ... for parameter 'Gain'" would seem to indicate that you're trying to set the Gain parameter to something invalid for that parameter. You have to set the Gain parameter for a block to a string or character array. So, for instance, to set the gain to 3, you would have to execute set_param(gcb,'Gain','3'), not set_param(gcb,'Gain',3).
You might also consider setting the Gain parameter to a variable which you define in the MATLAB workspace or in the model workspace. The Simulink Onramp gives some examples of how to pass variables from MATLAB to Simulink in the "Simulink and MATLAB" module, if that's helpful to you. If you go that route, you can just set that variable in your DAC script, without needing to worry about interfacing directly into the Simulink model and getting the set_param syntax correct.
  댓글 수: 2
Biplob Chowdhury
Biplob Chowdhury 2023년 7월 10일
편집: Biplob Chowdhury 2023년 7월 10일
Thank you for your answer.
I am using 'Ki' as tuneable parameter. Please have a look at the screenshot. The 'line 251' is a command to start the simulation in Simulink.
Best regards
Daniel
Daniel 2023년 7월 10일
I'm not familiar with tunable parameters and realp, so I won't be able to help with that error without a model to run. Perhaps someone else has more experience.
That being said, do you need to modify the parameter value during a single simulation? Or do you only need to modify it between simulations?
If the parameter can remain constant over the course of a simulation, you shouldn't need to use tunable parameters at all. Just set Ki to whatever value you want the gain to take, in the MATLAB script, and set the value of the gain block to Ki in the model.
If the parameter needs to update over the course of the simulation, you can adjust the value in MATLAB during simulation. Running set_param(<model>,'SimulationCommand','update') should update the Simulink model to use the new value from the MATLAB workspace.

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

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by