06.08.2013 Views

JAVA-BASED REAL-TIME PROGRAMMING

JAVA-BASED REAL-TIME PROGRAMMING

JAVA-BASED REAL-TIME PROGRAMMING

SHOW MORE
SHOW LESS

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 />

Washing machine<br />

4.7. Exercise 5 - Mailbox and lab 3 preparation<br />

Your task is to develop the control software for a washing machine. The<br />

machine is equipped with water level and temperature sensors. In addition,<br />

four buttons allow the user to select a washing program (1, 2, 3) or stop the<br />

machine (0). Output signals from your software will control the following:<br />

• A valve for letting water into the machine.<br />

• A drain pump for draining the machine.<br />

• A heater for heating the water.<br />

• A motor for rotation of the barrel. The motor has the modes left spin,<br />

right spin, fast spin (centrifuge), and stop.<br />

Exercise<br />

During the exercise session, the general design of the control software is discussed,<br />

including threads and communication mechanisms. The handout code<br />

contains a skeleton design that you need to understand and build on for your<br />

implementation. A complete system should be implemented before the lab session.<br />

• Which concurrent activities (i.e., threads) do you need? Think about<br />

which inputs the system should handle, and how it should handle them.<br />

• Is there any thread that is more time-critical than the rest (and should<br />

be given a higher priority)?<br />

• Is it appropriate to introduce more threads to accomplish a clearer and<br />

more understandable design?<br />

• Will the CMLA requirements be easy to verify (by quickly inspecting<br />

the code) in your implementation?<br />

• Which threads need to communicate? Draw a simple diagram to show<br />

your design. What information (which classes) should be communicated?<br />

Mailboxes should be used to send events for thread synchronization and communication.<br />

123

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!