DSP component PI, PID issues
Moderator: Benj
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
DSP component PI, PID issues
Hi!
I guess the experiment Flowvcode V6 PID Help / Example program.
It works well.
How to change this program, the P, I and D floating-point variables?
How do I assign a variable?
http://www.matrixtsl.com/wiki/index.php ... _component
I guess the experiment Flowvcode V6 PID Help / Example program.
It works well.
How to change this program, the P, I and D floating-point variables?
How do I assign a variable?
http://www.matrixtsl.com/wiki/index.php ... _component
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: DSP component PI, PID issues
Hello,
Currently the PI and D values are fixed via the property settings and cannot be altered during runtime. We might be able to add in an option to allow for changes on the fly so I will look into this for you and see how easy it would be.
Currently the PI and D values are fixed via the property settings and cannot be altered during runtime. We might be able to add in an option to allow for changes on the fly so I will look into this for you and see how easy it would be.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
Re: DSP component PI, PID issues
Hi!
Thank you!
It would be very nice if you could use the external variable.
Now I make a motor controller, and so the development is very slow.
Thank you!
It would be very nice if you could use the external variable.
Now I make a motor controller, and so the development is very slow.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: DSP component PI, PID issues
Hello,
Right I've had a bit of a go at allowing the PID parameters to be controlled on the fly during program execution.
I've not tested it but I think sim and download should both work ok with the new ChangePID macro.
Let me know how you get on.
Right I've had a bit of a go at allowing the PID parameters to be controlled on the fly during program execution.
I've not tested it but I think sim and download should both work ok with the new ChangePID macro.
Let me know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
Re: DSP component PI, PID issues
Thanks for your help!
Unfortunately we could not compile the program.
Added to the error message and the program.
Unfortunately we could not compile the program.
Added to the error message and the program.
- Attachments
-
- PI_Control_default.fcfx
- (18.31 KiB) Downloaded 233 times
-
- PID.jpg (59.05 KiB) Viewed 7869 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: DSP component PI, PID issues
Hello,
Thanks for letting me know. I think I have now fixed the bug causing the compilation error.
Let me know how you get on.
Thanks for letting me know. I think I have now fixed the bug causing the compilation error.
Let me know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
Re: DSP component PI, PID issues
Hi!
Thank you, it works.
I found some interesting problems in this project.
Main Programme float variable
-define as
-modify value
-converted to use a string variable
ADC voltage reading on the float variable
or
-Float converters use a string variable
-byte integer variable or string literals be converted
Stack overflow occurs.
The microcontroller reset constantly.
If timer interrupts do the above programs are good.
Why do you point the main program stack overflow?
Thank you, it works.
I found some interesting problems in this project.
Main Programme float variable
-define as
-modify value
-converted to use a string variable
ADC voltage reading on the float variable
or
-Float converters use a string variable
-byte integer variable or string literals be converted
Stack overflow occurs.
The microcontroller reset constantly.
If timer interrupts do the above programs are good.
Why do you point the main program stack overflow?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: DSP component PI, PID issues
Hello,
Are you getting any warnings when you compile your project? Also can you post the project so we can have a look and suggest different ways to proceed?
Are you getting any warnings when you compile your project? Also can you post the project so we can have a look and suggest different ways to proceed?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
Re: DSP component PI, PID issues
Hello!
I get an error message.
Added to the modified example program.
I get an error message.
Added to the modified example program.
- Attachments
-
- PID_Control_x.fcfx
- (18.62 KiB) Downloaded 213 times
-
- PID_WARNING.jpg (145.13 KiB) Viewed 7803 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: DSP component PI, PID issues
Hello,
As you are compiling using an 8-bit PIC this uses the BoostC compiler which has issues surrounding float variables. They are handled using functions rather than natively via the language and so cannot be re-entered in the main and again via an interrupt.
To get around the problem can you move the GetVoltage and FloatToString function into the interrupt.
Or you could move all the interrupt code into main and use the trigger functionality to control the calling of the DSP chain.
As you are compiling using an 8-bit PIC this uses the BoostC compiler which has issues surrounding float variables. They are handled using functions rather than natively via the language and so cannot be re-entered in the main and again via an interrupt.
To get around the problem can you move the GetVoltage and FloatToString function into the interrupt.
Or you could move all the interrupt code into main and use the trigger functionality to control the calling of the DSP chain.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
Re: DSP component PI, PID issues
Hello!
I want to use PID control example.
I looked at the simulator, but not control.
Only 50% duty square wave is the PWM output.
8bit controller 18F452 temperature control would be a problem.
Even the Simulator Flowcode not change the duty.
If the adc adc feedback or setpoint change, the need to change the PWM duty cycle as well.
This does not happen.
It is also possible to use the timer tick timer macros without interruption?
I want to use PID control example.
I looked at the simulator, but not control.
Only 50% duty square wave is the PWM output.
8bit controller 18F452 temperature control would be a problem.
Even the Simulator Flowcode not change the duty.
If the adc adc feedback or setpoint change, the need to change the PWM duty cycle as well.
This does not happen.
It is also possible to use the timer tick timer macros without interruption?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: DSP component PI, PID issues
Hello,
Can you post your program so we can try and see the issue.
Can you post your program so we can try and see the issue.
Yes this is possible, no interrupt is strictly required. The tick macros process one value in the buffers, the none tick functions will loop through and will process all values in the buffers in one operation.It is also possible to use the timer tick timer macros without interruption?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
Re: DSP component PI, PID issues
Hello!
This sample program can be downloaded from the DSP.
Interruption is due to stack overflow.
This sample program can be downloaded from the DSP.
Interruption is due to stack overflow.
Serious Warning: Possible sw stack corruption, function 'FC_CAL_ADC_Disable' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)
Serious Warning: Possible sw stack corruption, function 'FC_CAL_ADC_Enable' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)
Serious Warning: Possible sw stack corruption, function 'FC_CAL_ADC_Sample' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)
- Attachments
-
- pid_ex_default.fcfx
- (16.41 KiB) Downloaded 149 times
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
Re: DSP component PI, PID issues
Hi
The help menu DSP example is not the same as the download site matrixtsl DSP examples.
Inserts the Help menu adapted modified for example program.
Will be so good?
The help menu DSP example is not the same as the download site matrixtsl DSP examples.
Inserts the Help menu adapted modified for example program.
Will be so good?
- Attachments
-
- PID_Control_help_example.fcfx
- (17.27 KiB) Downloaded 164 times