Page 1 of 1

can the DSP_PID controller be extended?

Posted: Tue Jan 11, 2022 8:16 am
by SpeedPIC32
hello together
can the pid controller be extended?
What are the maximum values the PID can process at the moment and what does it output?
What is the effect of sample time if I get new values from the adconverter in a program loop in the second 10 and the PID controller is queried? Does the PID controller have its own clock / loop time, e.g. 100 samples?
Is it possible to change the P,I,D values externally? Pvalue = 12 Ivalue = 0,1 Dvalue=0 via RS232
My data ranges that I need.
Setpoint and actual value 0 to 350°C in 0,1°C steps.
Setpoint: from PC via RS232
Actual value: from 24bit ADC and display on PC via the same RS232 e.g. 100.52°C
Set PID values, also from PC
Output value for controlling the power supply via second RS232: 0 to 2000 maximum adjustable up to 5000 in steps of one

With kind regards

Re: can the DSP_PID controller be extended?

Posted: Tue Jan 11, 2022 1:18 pm
by SpeedPIC32
Hello
I have played a little bit more.
I get my values transferred to the pid.
I simply turn 300.52°C into 30052 Ulong.
the output of the pid is then Uint to 65535
I can take over the P,I,D data as it is.
One question remains: What happens to the Sample Time value?
under Properties:
Ti must be called integration factor
Td must be called derivative factor
Both times a factor is entered and no time.
The time is added by the loop time in the example 100ms.

When I use DSP input ADC in the simulation, I have noticed that the display does not fit in the 2D dashboard:
in the 2D Dashboard the display does not match the variable and the PIC ADC.
First of all, the value under chr must not go up to 256, then it becomes 0 again.
under UInt 1023 is displayed but a scale up to 65536 must be displayed on 1023
under int only 1023 is output with a wrong scale +-32768 should be set to +-511
both long are also not correct with this PIC as well as float on 65536/65535

PID_Control test.fcfx
(12.09 KiB) Downloaded 125 times

Re: can the DSP_PID controller be extended?

Posted: Thu Jan 13, 2022 2:32 pm
by SpeedPIC32
Hello

since no one is answering, it's done.
I have written my own routine.
thanks for this

Re: can the DSP_PID controller be extended?

Posted: Mon Jan 17, 2022 10:23 am
by BenR
Hello,

Sorry for the lack of answer, I'm currently focussed on other things and this one seems to have slipped through the net.

Glad you have got what you wanted working.
What are the maximum values the PID can process at the moment and what does it output?
I think at the moment this might be in the range of an int 0-65535 but I am working in longs and floats to the DSP components so we should be able to do the full range of values soon.
One question remains: What happens to the Sample Time value?
under Properties:
This is just for calculation purposes, you need to call the process macro as part of a timer interrupt for fixed timings. The examples on the wiki should help with this.