Azzera filtri
Azzera filtri

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

84 visualizzazioni (ultimi 30 giorni)
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 Commenti
Biplob Chowdhury
Biplob Chowdhury il 10 Lug 2023
Hello Sam,
Thank you for your reply.
I am using 'Ki' as tuneable parameter. Please have a look at the screenshot.
Best regards

Accedi per commentare.

Risposte (1)

Daniel
Daniel il 10 Lug 2023
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 Commenti
Biplob Chowdhury
Biplob Chowdhury il 10 Lug 2023
Modificato: Biplob Chowdhury il 10 Lug 2023
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 il 10 Lug 2023
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.

Accedi per commentare.

Categorie

Scopri di più su Programmatic Model Editing in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by