Z transform of real-time input to discrete transfer function

670 Views Asked by At

I am trying to implement a first order discrete transfer function to model a small centrifugal pump to control its output flow rate. I started with a continuous first order transfer function which relates outlet flow to an input voltage sent to the driving DC motor given as: $$ \frac{K_{gain}}{\tau s+1} $$ Where $ K_{gain} $ represents the steady state flow rate response to a step input and $\tau$ the time constant. (The flowrate is linearly related to the input voltage in the range 0-10v).

I require a difference equation representation of this continuous transfer function to implement programmatically at sample rate $\frac{1}{T}$. Since I am using an artificial neural network controller with back propagation (i.e. it trains itself), I don't have the function of the input voltage (control) signal in advance to multiply with the transfer function to predict its output. The discrete transfer function I derived which included a ZOH was: $$ G(z)=\frac{K_{gain}(1-e^{-T/\tau})}{z-e^{-T/\tau}} $$ I can convert this to a difference equation with something like WolframAlpha but I'm missing the discrete input signal representation. I have also tried taking the inverse Laplace transform of the continuous transfer function and blindly applying the RK4 technique to solve the resulting ODE in real-time which produced a result although did not reflect the time constant and steady state values I set.

Have I made an error somewhere or overlooked something? I've exhausted all options I can think of and would appreciate any insight, thanks.