3.3 Extended Automata
a) Cruise control
A cruise control is a feature of many modern cars that helps to automatically hold a minimum speed. Create an extended automaton of the control unit of the cruise control based on the given description:
The control unit has a lever, which can be in position "on" or "off".
From the "on" position, the lever can also be pushed towards "cancel", but automatically jumps back to "on" afterwards. Furthermore, there are two buttons "RES+" and "SET-" which can be pressed at any time.
The device operates in the following manner: If it is pushed from "off" to "on", the cruise control goes into the standby mode in which it expects further inputs. Pressing the "SET-" button activates the cruise control and sets the current speed as the minimum speed. Furthermore, the display now shows the cruise control sign. If the lever is pushed towards "cancel", the cruise control returns back into the standby mode in which the speed will not be held any more and the cruise control sign goes off. However, the last configured speed is buffered.
Upon pressing the "RES+" button in the standby mode, the cruise control is activated with the last buffered speed setting. If there is no last speed buffered, "RES+" behaves as "SET-". When the cruise control is active, the minimum speed can be increased or deceased by 5 km/h by pressing the "RES+" or "SET-" button respectively. In case the car drives faster then the adjusted speed and the cruise control is active, the current speed can be taken as the new minimum speed by pressing the "SET-" button.
The cruise control can always be turned off by pushing the lever towards the "off" position. The last buffered speed will be rejected. If the cruise control is already turned off, pressing the buttons "SET-", "RES+" has no influence.
- Write down the sets of the states, inputs and outputs in formal mathematical way.
- Model the control unit as an extended automaton. Only Mealy outputs are required.
- The target speed defined by the cruise control should be stored as variable v_set.
- You only need to model the control unit at the steering wheel. The processes "speed up", "slow down" or "hold speed" do not need to be modelled separately, it suffices to assign the variable v_set as mentioned and make it clear from the state names in which states the cruise control is active or inactive.
- The current speed of the car can be detected by calling the function the function "v()" in conditions or variable assignments.
- The cruise control sign can be turned on with the "sign_on"-output and turned off with "sign_off"-output.
b) Complex cruise control
Imagine the cruise control now only supports minimum speeds within a certain range. Add restrictions to the extended automaton from exercise a) as described below:
- The cruise control minimum speed cannot be set above 190 km/h and must be at least 30 km/h.
- If the cruise control is activated with the current speed while the car is too fast or too slow, the respective button has no effect.
- If the cruise control is already active, raising the speed above the maximum has equally no effect. However, if the minimum speed is set to a value below 30 km/h by pressing the "SET-" button, then the cruise control changes into the standby mode.
Given is the following automaton. Transform it into pseudo code as it was done at page 62.
Fig. 3.3 c) Copier