A controller for controlling the pump unit of an oil well includes a sensor having
a first and second probe for placement in the flow of oil from the well bore. Each
of the probes contains a heater. A constant power source is selectively connected
to one of the heaters. Each of the probes also include a linear RTD at each of
their tips respectively for generating a signal indicative of the temperature measured
at each of the first and second probes. A control unit receives signals from the
RTD's and determines a flow rate therefrom. A pump control signal is generated
in response to the flow rate, wherein pump control signal continuously varies a
predetermined parameter of a pumping unit during operation of the pumping unit.