1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Zero order hold -- Discrete control systems

  1. May 28, 2015 #1
    I have some questions related to how a discrete control system is designed.
    One method is to design the controller in the continuous time domain, arriving at a transfer function (in the s-domain). After that, a transfer function for the ADC system must be taken into consideration. I will suppose a zero order hold circuit is used. So, before finding the transfer function in the z-domain, we multiply our initial transfer function with the transfer function of the ZOH circuit (##G_{ZOH}(s) = \frac{1-e^{-sT}}{s}##). After that, we can transform the overall transfer function from the s-domain to the z-domain. After we have the z transfer function, we can design an algorithm to compute the current output based on past input and/or output.

    My question is why do we need the ZOH circuit. I think it is because adding it to the system (in the s-domain) we get a simulation of how the discrete system will behave. We force the continuous transfer function to have a constant input throughout one "sampling period". Is this correct? But why do we keep it when converting from s-domain to z-domain?
  2. jcsd
  3. May 28, 2015 #2


    User Avatar
    Science Advisor

    Most ADC need a constant input while converting, therefore some Sample-and-Hold is necessary. Even if you use a super-fast tracking ADC, your digital circuit cannot read the input more than once per processing cycle.
  4. May 28, 2015 #3
    The ultimate goal of such a design is to get to a difference equation which can be implemented using a "computer", correct? So why do I need to take into consideration the effect of the ZOH when converting to the z-domain? If from the s-domain I realize that the input signal needs to be integrated, why isn't enough for me to come up with a difference equation like output(kT) = output(k(T-1)) + input(kT)? Why do I need to also consider the ZOH effect?
  5. May 28, 2015 #4


    User Avatar
    Gold Member

    Say you have a resistor (2Ω) which you supply by a voltage V = 24V.

    You get a output current through the resistor: I = U/R = 12A. The transfer function H(z)= Iout(z)/Vin(z) = 0.5.

    Now you make a model of the resistor that just measures the input ( Vin ) through a switch that is closed very shortly at the start of every sample period, then it multiplies the measured input by 0,5 and transfers the result as an output. The output will look like this:

    | | | | | | |

    which has nothing with constant 12A current to do. Therefore the integration in a ZOH-circuit that will give you the correct output: A constant current = 12A
  6. May 28, 2015 #5
    If I were to write the "algorithm" for such a system, wouldn't it be simply:

    Vout = Vin/2; // output = {previous outputs} + {previous/current inputs}, the difference equation the z transform represents
    output(Vout); ?

    And this sequence would be executed at the beginning of every sample period. It is true that I need to hold the output constant during the sampling period, but I do not need to take it into consideration when designing the "algorithm".
  7. May 28, 2015 #6


    User Avatar
    Gold Member

    I assume that you write the Vout-value to some latch, connected to a DA-converter:


    Here the /STR input is connected to the /WR signal and thereby a ZOH is included in your example, as the latch will "hold" the value until next sample period ( next output ).

    Doing so physically, you must include it in your math. Otherwise the math-world will not match the physics-world.
    Last edited: May 28, 2015
  8. May 28, 2015 #7
    Let's take a concrete example of a continuous controller, like G(s) = (s+2)/(s+10). It has a G(z) equivalent. Having the transfer function, I can create the algorithm based on the difference equation. Now, if I consider a sampler + a ZOH before the controller, I get a new transfer function, ##G'(s) = \frac{1-e^{-sT}}{s} \frac{s+2}{s+10}##. This has another equivalent G'(z), which results in another difference equation. My problem is why I need to "add" the effect of the ZOH in the difference equation. Isn't the ZOH like a "consequence" of using a digital controller? Thank you for your time.
  9. May 28, 2015 #8


    User Avatar
    Gold Member

    Say you have an analog controller, wherein there is many tranfer function blocks so as the total analog transfer function could be

    T(s) = A(s) * B(s) * C(s)

    You know ( I hope ) that T(z) A(z) * B(z) *C(z), so you must calculate the z-transform for T(s) as a whole. There is no problem here.

    The "problem" arises when the interface in your controller/computer samples an analog input. In fact the analog signal is cut into "spikes" (discrete values) that are handled as spikes through the computer (just discrete signals). But having calculated a control-loop the output is not represented as spikes. Somewhere in the controller there is a ZOH so that the output will be a series of step-functions ( not pulse-functions ). You cannot tune/calculate parameters for filters in your program without regard to that this ZOH takes place. Your calculations will be wrong because a step-function is different from a pulse-function. You can say that the problem arises because the discrete signals in the controller crosses the interface and in the outside world changes "shape" from af pulse-signal to a step-function signal.

    Assuming that the time-delay as for the calculations = 0, you need only one ZOH, despite there may be more filters in series in your controller and that the plant is included somehow in the control-loop.

    In practice there is a "work-around" for all these problems with ZOH, time-delays, and so on: Simply program your controller to output some (known) function, sample some data from the response from the plant ( the output is time-delayed by a "dummy code", simulating the calculation delay ): From the output and response-data you can exact calculate the tranfer function as for the plant, included ZOH, time-delays, etc.
    Last edited: May 28, 2015
  10. May 28, 2015 #9
    I still don't think I understood correctly, I apologize. If I want to simulate what will happen, then yes, I need to add the effect of the ZOH to the computation. But when writing the algorithm, why exactly do I need to "create" myself the effect of the ZOH inside the controller? Isn't this effect happening and I somehow need to take care of that, not adding this possibly unwanted effect? Everywhere on the Internet, the effect of the ZOH added before the controller is considered when transforming from s to z domain. Is this only for the purpose of simulating what happens, but it is not used when actually designing the controller? Is there any source from which I could study these topics?
  11. May 28, 2015 #10


    User Avatar
    Gold Member

    You don't have to "create" the ZOH as for physical reasons, because it is already there physically.

    But you have to create in your math, because the math must know about it to work proporly. You are telling the math of the existence by adding:

    (1 - e-sT) / s before doing the z-transform.

    You may try to make a simple RC-circuit. Calculate a transfer function H(s) = Uout(s) / Uin(s).
    z-transform H(s) → H(z).
    Calculate the output from H(z) when Uin(z) = 1: Does it look reasonable?

    Now add the ZOH. Try again.
  12. May 28, 2015 #11
    This is what the output looks like for an RC circuit with R=C=1, the output being the voltage on the capacitor and the input a unit step. The plot is made both using a ZOH and not using a ZOH. Are my computations correct? When considering a ZOH, the input must be considered as being sampled, so a series of impulses. Is this correct?

    Attached Files:

  13. May 28, 2015 #12


    User Avatar
    Gold Member

    You have shown the output of H(s) with/without ZOH. ( nothing is sampled here ).

    I'd see the output of H(z) with/without ZOH.
  14. May 28, 2015 #13
    I just wanted to make sure it is correct. These are the plots for the z transforms. I don't know how to plot only at discrete values. Are these correct?

    Attached Files:

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook