How to customize a Built-in PID Block?
古いコメントを表示
I am using a PID controller in a feedback system. I need to change the gain's multiplication type from element-wise to the matrix. I right clicked on the PID block then from link options, I disabled the link. Now after I looked under the mask, I could change the Gain's multiplication type. but after I save the model and run the simulation again everything goes back to its initial settings like I never applied any change! So my question is How can I customize the PID block in SIMULINK?
採用された回答
その他の回答 (2 件)
Azzi Abdelmalek
2012 年 10 月 4 日
編集済み: Azzi Abdelmalek
2012 年 10 月 4 日
I see your problem, but you can change these setting by code, just after loading your model named 'model.mdl'
set_param('model/PID Controller/Proportional Gain','Multiplication','Matrix(K*u)')
or you can associate this code with your model:
right click on your model- properties-callbacks-init Fcn (copy and paste the code)
10 件のコメント
Azzi Abdelmalek
2012 年 10 月 4 日
Check the setting after simulation
Mike
2012 年 10 月 4 日
Azzi Abdelmalek
2012 年 10 月 4 日
編集済み: Azzi Abdelmalek
2012 年 10 月 4 日
Mike, This is another question. It's difficult to answer if we haven't your model. And I think, maby you should make the same change to Integral gain and Derivative Gain. Because their outputs will be additionned
Mike
2012 年 10 月 4 日
Azzi Abdelmalek
2012 年 10 月 4 日
編集済み: Azzi Abdelmalek
2012 年 10 月 4 日
I don't think you did what I suggested:
- In your model named model.mdl right click
- then click on model properties
- then click on Callbacks
- then click on init fcn and place this code for your 3 gain
set_param('model/PID Controller/Proportional,...
Gain','Multiplication','Matrix(K*u)')
set_param('model/PID Controller/Integral,...
Gain','Multiplication','Matrix(K*u)')
set_param('model/PID Controller/Derivative,...
Gain','Multiplication','Matrix(K*u)')
Yes after simulation the setting will change, but no worries at the begening of each simulation, the above code will be executed
If you want keep the setting unchanged, place again the same code in callbacks stop - fcn
Mike
2012 年 10 月 5 日
Azzi Abdelmalek
2012 年 10 月 6 日
編集済み: Azzi Abdelmalek
2012 年 10 月 6 日
Mike, I 'am getting, errors too, but it has nothing to do with the setting of Multiplication
If I find something, I will post it.
Mike
2012 年 10 月 6 日
Azzi Abdelmalek
2012 年 10 月 6 日
編集済み: Azzi Abdelmalek
2012 年 10 月 6 日
I think the setting vanishes just when the simultion start, not after like I said. I suggest to Edit mask of your PID block then unmask it. when you start simulations other errors will occur, asking about:
- output/param (min/max). set them to []
- datatype(etc...) set them to double
save the target of this link
Mike
2012 年 10 月 7 日
Babak
2012 年 10 月 3 日
0 投票
You don't want to edit Simulink's Built in blocks.
Instead you want to create your own custom blocks. You could do it with creating an S-function block and creating a mask for it or making a MATLAB based block which runs an m-file.
カテゴリ
ヘルプ センター および File Exchange で Interactive and Graphical Tuning についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!