Control Systems/State Machines
Digital computers have a lot more power and flexibility to offer than processing simple difference equations like the kind that we have been looking at so far in our discrete cases. Computer systems are capable of handling much more complicated digital control tasks, and they are also capable of changing their algorithms in the middle of the processing time. For tasks like this, we will employ state-machines to allow us to dynamically control several aspects of a single problem with a single computer.
A state machine, in its simplest form, is a system that performs different actions, depending upon the state of the machine.
A state diagram depicts the different states of a state machine, and it uses arrows to show which states can be reached, and what are the conditions for reaching them.
Consider a common controls example of a movable cart that is attached to a horizontal pole. This cart, like the print-head on a printer, is free to travel back and forth across this pole at finite speeds. Dangling from the cart is a pendulum that is capable of freely spinning 360 degrees around its pivot point.
As the cart moves back and forth across the horizontal pole, the pendulum will swing side-to-side. In fact, if the cart moves quickly enough, and in the correct pattern, the pendulum will actually swing up over the top of the cart, and travel a full 360 degrees. The purpose of this contraption is to swing the pendulum upwards so that it is standing up vertically above the cart, and to balance it as such. There are then two distinct stages of operation for our control system:
- we must swing the pendulum from directly downward, to standing vertical
- we must balance the pendulum vertically