# [time-nuts] PI Math question

Ulrich Bangert df6jb at ulrich-bangert.de
Thu Apr 17 15:42:08 EDT 2014

```Warren,

I understand your message as an afterwards try to put some sense in your
original question, but if you write

> D = (Input - Last_Input)

then this clearly denotes the differential part of a PID controller (with
the multiplication with the coefficient for the differential part coming
later)

> In a complete controller the input to this
> gain block would typically come from a
> pre-filter, and the prefilter's input
> from the error difference between
> the setpoint and the feedback, etc.

saying that "input is something complete different then I fear that this
discusion is drifting into complete nonsense because if "Input" denotes an
entity which contains an error signal in any form then

> D = (Input - Last_Input)

is something that is ill defined and has nothing to do with the differential
part of a PID controller.

> I wanted to keep the math as simple as possible...

Good idea but if simplification creates something wrong then the
simplification has gone one step to far.

Best regards

Ulrich

> -----Ursprungliche Nachricht-----
> Von: time-nuts-bounces at febo.com
> [mailto:time-nuts-bounces at febo.com] Im Auftrag von WarrenS
> Gesendet: Donnerstag, 17. April 2014 11:54
> An: Discussion of precise time and frequency measurement
> Betreff: Re: [time-nuts] PI Math question
>
>
> Ulrich
>
> That is correct, none of these simple code blocks form a
> controller. This is just a block of code that could be used
> for the PI gain function of
> a controller.
> In a complete controller the input to this gain block would
> typically come
> from a pre-filter,
> and the prefilter's input from the error difference between
> the setpoint and
> the feedback, etc.
> I wanted to keep the math as simple as possible by only
> including this
> section of code.
>
> My question was does the math in these four blocks of code
> all provide the
> same exact input to output function.
> What the code is being used for is not really relevant to the answer.
>
> simple example:
> Does the code X = 3Y  have the same input to output function
> as X = 4 + 2 +
> (1+2) *Y - 6?
> Just because they look different does not mean they are
> different. The question was meant to be a simple math
> exercise like does 3y = (1+2)y? The answer does not need any
> high level math or depend on the value of y or
> what the code is being used for.
>
> ws
>
> *******************
> ----- Original Message -----
> From: "Ulrich Bangert" <df6jb at ulrich-bangert.de>
> To: "'Discussion of precise time and frequency measurement'"
> <time-nuts at febo.com>
> Sent: Thursday, April 17, 2014 1:14 AM
> Subject: Re: [time-nuts] PI Math question
>
>
> > Warren,
> >
> > the job of a controller, regardless of P, PI od PID, is to minimize
> > the error between a process value and its setpoint. Since I see no
> > setpoint value in any of your versions my 50 ct is that
> none of them
> > really incorporates a controller at all and that for this
> reason the
> > question whether they produce the same output is close to being
> > irrelevant.
> >
> > Best regards
> >
> > Ulrich
> >
> >> -----Ursprungliche Nachricht-----
> >> Von: time-nuts-bounces at febo.com
> [mailto:time-nuts-bounces at febo.com]
> >> Im Auftrag von WarrenS
> >> Gesendet: Mittwoch, 16. April 2014 18:50
> >> An: Discussion of precise time and frequency measurement
> >> Betreff: [time-nuts] PI Math question
> >>
> >> A question to the math time-nuts
> >>
> >> With the values of K1, K2 & K3 constant,
> >> and the initial state of I#1, I#2 and Last_Input all zero assuming
> >> there is no rounding, clipping or overflow in the math and that if
> >> I've made any obvious dumb typo errors, that they are corrected,
> >>
> >> Given this PID type of controller;
> >> D = (Input - Last_Input))
> >> Last_Input = Input
> >> I#1 = I#1 + (K1 * Input)
> >> I#2 = I#2 + (K2 * D)
> >> Output = I#1 + I#2 + (K3 * Input)
> >>
> >> Is the above Input to Output's transfer function any
> different than
> >> any of the following more simplified versions of PI controllers?
> >> Or asked another way, if each of the four codes are given the
> >> exact same
> >> input string and same K Gains, will the difference between
> >> any of their  outputs ever be non zero?
> >>
> >>
> >> a)
> >> D = Input - Last_Input
> >> Last_Input = Input
> >> I#1 = I#1 +  (K1 * Input) + (K2 * D)
> >> Output = (K3 * Input) + I#1
> >>
> >> b)
> >> D = (Input - Last_Input)
> >> Last_Input = Input
> >> Output  = Output + (K1 * Input) + (K2 + K3) * D
> >>
> >> a)
> >> I#1 = I#1 + (K1 * Input)
> >> Output = I#1 + ((K2 + K3) * Input)
> >>
> >> ws
> >>
>
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to
> https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.

```