

On 24/07/2020 16:31, shall689 wrote:
> Hello,
>
> I have the frequency response data of a plant. What steps would I take to
> tune a PID in octave?
>
> Thanks,
> Stephen
>
>
Is your frequency response complex or just magnitude one ?
Sergei.


In reply to this post by Octave  General mailing list


 DAS


 DAS


> Hello,
>
> I have the frequency response data of a plant. What steps would I take to
> tune a PID in octave?
>
> Thanks,
> Stephen
For tuning there are several options, ZieglerNichols method is one but it might be better to do some mathematical analysis on how your gains effect the bode plot of the closed system. Noise may also be a problem if you do not want this to enter control loop, integral gain is least sensistivity for noise, proportional gain in between and derivative gain most sensitive to noise. Usually there is a choice between noise entering control loop, it may also make audible noise and speed. Charging batteries is a slow process while unstable processes like inverted pendulum must be fast enough to stabilized pendulum.
The tuned system may be checked with nyquist(...) by closing the control loop with your PID regulator. You probably want to check phase and amplitude margins, maybe also sensitivity.
System may be closed by transfer function if you have this but as I understand it you have frequency response. You may calculate frequency response of your PID regulator with bode(...) function and use numeric calculations on amplitudes and phases for your PID regulator and frequency response of plant. If do not know how to make these calculations I might try to get an hour or so thinkging about it and help you.
Nicklas SB Karlsson


Hello Nicklas,
I have a basic understanding control system analysis, but I don't normally
analyze control systems.
"You may calculate frequency response of your PID regulator with bode(...)
function and use numeric calculations on amplitudes and phases for your PID
regulator and frequency response of plant."
I would appreciate if you could help me.
Thanks,
Stephen

Sent from: https://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html


On Fri, 20200724 at 08:31 0500, shall689 wrote:
> Hello,
>
> I have the frequency response data of a plant. What steps would I take
> to
> tune a PID in octave?
>
> Thanks,
> Stephen
>
Hello Stephen,
Besides considering the stability margins with nyquist(), bode() or
margin(), you can also consider the following tools/methods from the
control package:
* optiPID to tune the PID controller based on an integral optimization
criteria
* rlocus() to plot the root locus for the closed loop depending on the
open loop gain
* rlocusx(), newly added to the control packages (but not yet in the
released version), which allows to get resulting controller gains for
specific root locations and plot related open loop bode, nyquist and
margin plots together with the step response of the closed loop
Best
Torsten


> Hello Nicklas,
>
> I have a basic understanding control system analysis, but I don't normally
> analyze control systems.
>
> "You may calculate frequency response of your PID regulator with bode(...)
> function and use numeric calculations on amplitudes and phases for your PID
> regulator and frequency response of plant."
> I would appreciate if you could help me.
G(jw) Frequency responce of your system
F(jw) Frequency response of PID regulator
Gry(jw) = F(jw)*G(jw)/(1 + F(jw)*G(jw)) Frequency response of closed system
Then you have frequency response with amplitude and angle for your system. First you have to calculate amplitude and angle for you PID controller at same frequencies. Calculations should be done point wise. For multiplication amplitudess are multiplied while angles are added. Divisor require some more thinking also by me but know value is multiplied with complex conjugate to get absolute value in square, convert from (phase, angle) form to (real, imaginary) should be one possibility. Calulations could be checked by doing them on a system on polynomial form, if numerical calculation on this agree with analytical you probably got it right.
To get Bode plot for the closed system you could use subplot(2,1,1) semilogy(...) subplot(2,1,2) and plot(...) functions.
To get nyquist diagram for stability analysis you plot with Gry(jw) for increasing frequencies with real part on x axis and imaginary part on y axis. If you have data on (phase, angle) form you have to convert to (real, imaginary) form.
Nicklas SB Karlsson


> Hello Nicklas,
>
> I have the open loop frequency response of 1/2 bridge inverter capacitor
> current (using PSIM). Now I would like to convert that response into a
> transfer function so that I can create the closed loop response (as you
> mentioned).
>
> I do have an exact transfer equation for the capacitor voltage with respect
> to duty cycle so maybe that can somehow be changed to capacitor current
> since capacitor current equals C*dv/dt. Maybe just multiplying by Cs would
> do it?
Best thing would be to write it down on state space form. As it is an inverter I would guess you could modify duty cycle each period and in such case duty cycle should be an input and you would make an average model over one cycle, there is probably some dead time which may or may not be important. In case it is non linear you also to have to linearize around curent working point.
Then written on state space form you could use lqr(...), lqg(...) or acker(...) functions in Octave to make you control loop while bode(...) and nyquist(...) functions could be used for stability analysis. In cause you did not att dead time in state space model you could add a phase delay then stability is checked.
Think I got it correct.
Nicklas SB Karlsson


> Hello Nicklas,
>
> I have the open loop frequency response of 1/2 bridge inverter capacitor
> current (using PSIM). Now I would like to convert that response into a
> transfer function so that I can create the closed loop response (as you
> mentioned).
>
> I do have an exact transfer equation for the capacitor voltage with respect
> to duty cycle so maybe that can somehow be changed to capacitor current
> since capacitor current equals C*dv/dt. Maybe just multiplying by Cs would
> do it?
Forgot about it. If you use lqr(..), lqq(...) or acker(...) functions feedback is assumed to come from internal states. It is still useful to write on state space form and there are functions to transform to transfer function in Octave if needed.


On Mon, 20200727 at 21:43 +0200, N wrote:
> > Hello Nicklas,
> >
> > I have a basic understanding control system analysis, but I don't
> > normally
> > analyze control systems.
> >
> > "You may calculate frequency response of your PID regulator with
> > bode(...)
> > function and use numeric calculations on amplitudes and phases for
> > your PID
> > regulator and frequency response of plant."
> > I would appreciate if you could help me.
>
> G(jw) Frequency responce of your system
> F(jw) Frequency response of PID regulator
> Gry(jw) = F(jw)*G(jw)/(1 + F(jw)*G(jw)) Frequency response of closed
> system
>
> Then you have frequency response with amplitude and angle for your
> system. First you have to calculate amplitude and angle for you PID
> controller at same frequencies. Calculations should be done point
> wise. For multiplication amplitudess are multiplied while angles are
> added. Divisor require some more thinking also by me but know value is
> multiplied with complex conjugate to get absolute value in square,
> convert from (phase, angle) form to (real, imaginary) should be one
> possibility. Calulations could be checked by doing them on a system on
> polynomial form, if numerical calculation on this agree with
> analytical you probably got it right.
>
> To get Bode plot for the closed system you could use subplot(2,1,1)
> semilogy(...) subplot(2,1,2) and plot(...) functions.
>
> To get nyquist diagram for stability analysis you plot with Gry(jw)
> for increasing frequencies with real part on x axis and imaginary part
> on y axis. If you have data on (phase, angle) form you have to convert
> to (real, imaginary) form.
>
>
> Nicklas SB Karlsson
>
For a stability analysis of the closed loop based on the Nyquist
criterion, you need the frequency repsonce (nyquist()) of the open loop,
not of Gry (jw), which represents the closed loop.
Torsten


> On Mon, 20200727 at 21:43 +0200, N wrote:
> > > Hello Nicklas,
> > >
> > > I have a basic understanding control system analysis, but I don't
> > > normally
> > > analyze control systems.
> > >
> > > "You may calculate frequency response of your PID regulator with
> > > bode(...)
> > > function and use numeric calculations on amplitudes and phases for
> > > your PID
> > > regulator and frequency response of plant."
> > > I would appreciate if you could help me.
> >
> > G(jw) Frequency responce of your system
> > F(jw) Frequency response of PID regulator
> > Gry(jw) = F(jw)*G(jw)/(1 + F(jw)*G(jw)) Frequency response of closed
> > system
> >
> > Then you have frequency response with amplitude and angle for your
> > system. First you have to calculate amplitude and angle for you PID
> > controller at same frequencies. Calculations should be done point
> > wise. For multiplication amplitudess are multiplied while angles are
> > added. Divisor require some more thinking also by me but know value is
> > multiplied with complex conjugate to get absolute value in square,
> > convert from (phase, angle) form to (real, imaginary) should be one
> > possibility. Calulations could be checked by doing them on a system on
> > polynomial form, if numerical calculation on this agree with
> > analytical you probably got it right.
> >
> > To get Bode plot for the closed system you could use subplot(2,1,1)
> > semilogy(...) subplot(2,1,2) and plot(...) functions.
> >
> > To get nyquist diagram for stability analysis you plot with Gry(jw)
> > for increasing frequencies with real part on x axis and imaginary part
> > on y axis. If you have data on (phase, angle) form you have to convert
> > to (real, imaginary) form.
> >
> >
> > Nicklas SB Karlsson
> >
>
> For a stability analysis of the closed loop based on the Nyquist
> criterion, you need the frequency repsonce (nyquist()) of the open loop,
> not of Gry (jw), which represents the closed loop.
>
> Torsten
It must be the closed loop, if using the open loop feedback gains are not included in the analysis.
With open loop frequency response it should however be possible to calculate closed looop frequency response.


On Tue, 20200728 at 23:18 +0200, N wrote:
> >
> >
> > For a stability analysis of the closed loop based on the Nyquist
> > criterion, you need the frequency repsonce (nyquist()) of the open
> > loop,
> > not of Gry (jw), which represents the closed loop.
> >
> > Torsten
>
> It must be the closed loop, if using the open loop feedback gains are
> not included in the analysis.
>
> With open loop frequency response it should however be possible to
> calculate closed looop frequency response.
The feedback gain is in F(jw) since this is the frequency response of
the PID controller (with gain). Therefore:
"Assessment of the stability of a closedloop negative feedback system
is done by applying the Nyquist stability criterion to the Nyquist plot
of the openloop system (i.e. the same system without its feedback
loop)." [1]
There are also forms of the criterion that are using the open loop
frequency response with gain 1 and where the number of closed loop poles
with positive real part can be determined depending on the open loop
gain.
Torsten
[1] https://en.wikipedia.org/wiki/Nyquist_stability_criterion

