Proportional
Control Over The Network Using LabView
Introduction
When you use proportional control, the following sequence of events takes
place.
-
Measure the output of
the system. Call that value Measured
Output.
-
Compute the error as the
difference:
-
Error = Desired Output
- Measured Output
-
Compute the control effort
by multiplying the error times the proportional gain.
-
Apply the control effort
to the controller.
Those steps are implemented in the diagram below.
In the diagram above, we assume the following.
-
The output is measured
on some remote computer, and is available over a network using a TCP/IP
connection. That TCP/IP connection is established in the TCP/IP
Open Connection block outside of the while
loop.
-
The TCP/IP Oopen Connection
block requires the user to input an IP address
for the remote computer and the number of
the port used to transmit the data by the
remoted computer.
-
The measurement data is
a string. That string will have a length longer than 10, so that
the length - expressed as an integer - has two digits, and that information
is input to the first TCP/IP Listen
block inside the while loop.
-
The string length is decoded
in a Scan-from-String block, and the integer output from that block is
used as an inpout in the next TCP/IP Listen block.
-
The second TCP/IP Listen
block gets the string that actually contains the measurement data, and
uses a Scan-from-String function which has an exponential/fractional output
to generated numerical data.
-
The Measured Output is
subtracted from the Desired Output (in a subtractor block) to form the
error.
-
The error is multiplied
by the proportional gain in a multiplier block. That gives us the
calculated Control Effort.
-
Since this is a numerical
computation, the output of the multiplier - the Control Effort - is a number.
To transmit the Control Effort to the remote computer requires that the
Control Effort be changed into a string format.
-
We use a 2f.3 format which
gives a string of the form xx.yyy.
-
The length of the string
is calculated - as a number - and converted to an equivalent string and
transmitted to the remote computer. The first piece of information
sent to the remote computer is the string length.
-
After the string length
of the Control Effort string is sent, the actual Control Effort string
is then transmitted to the remote computer.
-
The while loop continues
forever, or until the connection is terminated.
The
front panel for this vi is shown below.

Note the following in the front panel.
-
You can input the port
to use. Choose any unsed port. The one shown, 2055,
is a good choice since it is unlikely to be used by anything else in the
system.
-
The address must also
be entered. Although it shows localhost when the vi loads, you should
type the IP address of the remote computer there. The form is www.xxx.yyy.zzz,
the standard format for IP addresses.
-
Information you can enter
here is:
-
The desired output,
-
The proportional gain.
-
Information displayed
is:
-
The Measured Output -
numerically and on a "thermometer" display.
-
The Error - numerically
and on a "thermometer" display.
-
The number of iterations
the loop has run.
This
vi can get data from any remote system that is set up to provide data on
the measured output, and then act on a control effort signal that is sent
to it. The system is at the remote computer and connected to it with
any kind of computer controlled instruments (We have used IEEE488/GPIB
instruments) and the control algorithm is implemented in the LabView program
above.