Code generation problem about discrete PID Block
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I use the discrete PID block in my model. In simulation there's no problem, however when generating code some problems occurs.
Sample time of PID block is 100e-6. I must call the control block to hardware interrupt block (asyncronous) because of code generation. Therefore I change sample time to -1 and Integrator gain to IntegratorGain*SampleTime.
When analyzing generated code, Integrator gain is multiplied by elapsed time ('mode.block_ELAPS_T') variable which is calculated with Timing.clocTick value. I dont want to be added the elapsed time value because i use pid in pwm timer interrupt block (100e-6)
How to prohibit to generate elapsed time variable in c code. Thank you
0 个评论
回答(2 个)
Navaneeth Raman
2015-4-21
Hello,
The integrator gain would remain a constant and not change with each timestep if you set its gain to be IntegratorGain*SampleTime where I assume SampleTime is a constant. Do you have a model that you can share so that I can take a look at it and figure out what is going on?
Thanks, Navaneeth
0 个评论
YANBIN ZHAO
2015-7-19
Hi, SayGin:
Can not understand why in generated code, Integration Gain is not a constant. Can you share the model which is related with Integration Gain?
ZYB 2015.07.19
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!