Correctly implemented programs
This commit is contained in:
parent
81ee61c779
commit
3d5b098595
2 changed files with 17 additions and 4 deletions
|
@ -47,16 +47,23 @@ public final class WashingProgram1 extends ActorThread<WashingMessage> {
|
||||||
temp.send(new WashingMessage(this, TEMP_SET_40));
|
temp.send(new WashingMessage(this, TEMP_SET_40));
|
||||||
receive();
|
receive();
|
||||||
|
|
||||||
|
spin.send(new WashingMessage(this, SPIN_SLOW));
|
||||||
|
receive();
|
||||||
|
|
||||||
// Keep the temperature for 30 min
|
// Keep the temperature for 30 min
|
||||||
Thread.sleep(30 * 60000 / Settings.SPEEDUP);
|
Thread.sleep(30 * 60000 / Settings.SPEEDUP);
|
||||||
|
|
||||||
// Drain
|
// Drain
|
||||||
temp.send(new WashingMessage(this, TEMP_IDLE));
|
temp.send(new WashingMessage(this, TEMP_IDLE));
|
||||||
receive();
|
receive();
|
||||||
|
spin.send(new WashingMessage(this, SPIN_OFF));
|
||||||
|
receive();
|
||||||
water.send(new WashingMessage(this, WATER_DRAIN));
|
water.send(new WashingMessage(this, WATER_DRAIN));
|
||||||
receive();
|
receive();
|
||||||
|
|
||||||
// Rinse 5*2 minutes in cold water
|
// Rinse 5*2 minutes in cold water
|
||||||
|
spin.send(new WashingMessage(this, SPIN_SLOW));
|
||||||
|
receive();
|
||||||
for(int a = 0; a < 5; a++) {
|
for(int a = 0; a < 5; a++) {
|
||||||
water.send(new WashingMessage(this, WATER_FILL));
|
water.send(new WashingMessage(this, WATER_FILL));
|
||||||
receive();
|
receive();
|
||||||
|
@ -70,7 +77,7 @@ public final class WashingProgram1 extends ActorThread<WashingMessage> {
|
||||||
// Centrifuge for five minutes
|
// Centrifuge for five minutes
|
||||||
spin.send(new WashingMessage(this, SPIN_FAST));
|
spin.send(new WashingMessage(this, SPIN_FAST));
|
||||||
receive();
|
receive();
|
||||||
Thread.sleep(5 * 60000 / Settings.SPEEDUP);
|
Thread.sleep(10 * 60000 / Settings.SPEEDUP);
|
||||||
|
|
||||||
spin.send(new WashingMessage(this, SPIN_OFF));
|
spin.send(new WashingMessage(this, SPIN_OFF));
|
||||||
receive();
|
receive();
|
||||||
|
@ -81,6 +88,9 @@ public final class WashingProgram1 extends ActorThread<WashingMessage> {
|
||||||
water.send(new WashingMessage(this, WATER_DRAIN));
|
water.send(new WashingMessage(this, WATER_DRAIN));
|
||||||
receive();
|
receive();
|
||||||
|
|
||||||
|
water.send(new WashingMessage(this, WATER_IDLE));
|
||||||
|
receive();
|
||||||
|
|
||||||
// Now that the barrel has stopped, it is safe to open the hatch.
|
// Now that the barrel has stopped, it is safe to open the hatch.
|
||||||
io.lock(false);
|
io.lock(false);
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,9 @@ public final class WashingProgram2 extends ActorThread<WashingMessage> {
|
||||||
temp.send(new WashingMessage(this, TEMP_SET_40));
|
temp.send(new WashingMessage(this, TEMP_SET_40));
|
||||||
receive();
|
receive();
|
||||||
|
|
||||||
|
spin.send(new WashingMessage(this, SPIN_SLOW));
|
||||||
|
receive();
|
||||||
|
|
||||||
// Keep the temperature for 20 min
|
// Keep the temperature for 20 min
|
||||||
Thread.sleep(20 * 60000 / Settings.SPEEDUP);
|
Thread.sleep(20 * 60000 / Settings.SPEEDUP);
|
||||||
|
|
||||||
|
@ -72,7 +75,7 @@ public final class WashingProgram2 extends ActorThread<WashingMessage> {
|
||||||
receive();
|
receive();
|
||||||
|
|
||||||
// Rinse 5*2 minutes in cold water
|
// Rinse 5*2 minutes in cold water
|
||||||
for(int a = 0; a < 5; a++) {
|
for(int a = 0; a <= 5; a++) {
|
||||||
water.send(new WashingMessage(this, WATER_FILL));
|
water.send(new WashingMessage(this, WATER_FILL));
|
||||||
receive();
|
receive();
|
||||||
|
|
||||||
|
@ -90,10 +93,10 @@ public final class WashingProgram2 extends ActorThread<WashingMessage> {
|
||||||
spin.send(new WashingMessage(this, SPIN_OFF));
|
spin.send(new WashingMessage(this, SPIN_OFF));
|
||||||
receive();
|
receive();
|
||||||
|
|
||||||
temp.send(new WashingMessage(this, TEMP_IDLE));
|
water.send(new WashingMessage(this, WATER_DRAIN));
|
||||||
receive();
|
receive();
|
||||||
|
|
||||||
water.send(new WashingMessage(this, WATER_DRAIN));
|
water.send(new WashingMessage(this, WATER_IDLE));
|
||||||
receive();
|
receive();
|
||||||
|
|
||||||
// Now that the barrel has stopped, it is safe to open the hatch.
|
// Now that the barrel has stopped, it is safe to open the hatch.
|
||||||
|
|
Loading…
Reference in a new issue