automaton CMachine (1a, 1b)
{
  state idle, got_money, cooking, output;
  init idle;
  trans
    idle      -> got_money ( -,  money, 1a),
    got_money -> cooking   (1a,  start, 1b),
    cooking   -> output    (1b,   cook, 1b),
    output    -> idle      (1b, coffee,  -);
}

automaton ClientA (2)
{
  state idle, waiting;
  init idle;
  trans
    idle    -> waiting (2,  money, -),
    waiting -> idle    (-, coffee, 2);
}

automaton ClientB (3)
{
  state idle, waiting;
  init idle;
  trans
    idle    -> waiting (3,  money, -),
    waiting -> idle    (-, coffee, 3);
}

composite All 
{ 
  CMachine, ClientA, ClientB;
  restrictL (1b, coffee,  -),  (2,  money, -),  (3,  money, -),
           ( -,  money, 1a),  (-, coffee, 2),  (-, coffee, 3);
}

system All;


