JAVA-BASED REAL-TIME PROGRAMMING
JAVA-BASED REAL-TIME PROGRAMMING
JAVA-BASED REAL-TIME PROGRAMMING
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
4.7. Exercise 5 - Mailbox and lab 3 preparation<br />
1. The drain pump must not be running while the input valve is open.<br />
2. The machine must not be heated while it is free of water.<br />
3. There must not be any water in the machine when the hatch is unlocked.<br />
4. Centrifuging must not be performed when there is any measurable amounts<br />
of water in the machine.<br />
Handout code<br />
The hardware for the new washing machine is developed in parallel with the<br />
control software. To make it possible to test the control software early (and<br />
save some water), a software simulation of a washing machine has been developed.<br />
The simulator is available in the done folder of the handout code. Your<br />
control software should be implemented in the todo folder.<br />
Hardware access interface<br />
The abstract class AbstractWashingMachine describes the properties of a washing<br />
machine and provides operations for manipulating the (possibly simulated)<br />
hardware. Your control software will only communicate with the Abstract-<br />
WashingMachine class, not the concrete subclasses implementing the actual<br />
hardware interface and the simulation.<br />
package done;<br />
/**<br />
* Abstract description of a washing machine. Specialized<br />
* into simulations and actual hardware implementations.<br />
*/<br />
public abstract class AbstractWashingMachine {<br />
/**<br />
* Read the water temperature.<br />
* @return Temperature in Centigrades (0-100).<br />
*/<br />
public abstract double getTemperature ();<br />
/**<br />
* Read the water level in the machine.<br />
* @return A real number between 0 and 1, where 1 indicates an<br />
* absolutely full (i.e. overflowing) machine and 0<br />
* indicates a (practically) empty one.<br />
*/<br />
public abstract double getWaterLevel ();<br />
/**<br />
* Check if the front door is open.<br />
* @return True if the door is locked , false if it is open.<br />
*/<br />
public abstract boolean isLocked();<br />
125