fret icon indicating copy to clipboard operation
fret copied to clipboard

Description of Flashing Light

Open leesoons opened this issue 4 years ago • 3 comments

Hello, I try to use fret to describe the following requirements:

After the user presses the start button, the light flashing cycle begins, that is, the light L1 turns on and turns off after 1s; then the light L2 turns on and turns off after 1s; then the light L3 turns on and turns off after 1s; then the light L1 turns on... Keep going.

Here is one idea for my case:

  • when start_btn the sys shall until stop_btn satisfy toggled_state=on.

  • In toggled mode the sys shall after 1 seconds satisfy !L1.

  • In toggled mode unless L1 the sys shall after 1 seconds satisfy !L2.

  • In toggled mode unless L2 the sys shall after 1 seconds satisfy !L3.

  • In toggled mode unless L3 the sys shall after 1 seconds satisfy !L1.

(the toggled mode is associate with the toggled_state variable; start_btn and stop_btn are inputs, and L1/2/3 are outputs)

But because of the semantic of unless, if L2 and L3 is false at the first point in toggled mode, the wrong behavior of toggled mode will be as follows: image

I don’t know whether my understanding is wrong. Is there a valid description of this requirement ?

I would appreciate it if you could give me an answer.

leesoons avatar Dec 06 '21 11:12 leesoons

Thank you for your interesting scenario! I think you have formulated correctly in your first requirement entering and leaving toggling mode. I think you understand the semantics of unless. However, as there should always be two lamps off, that means that two of the last three of your requirements will be applicable, hence specifying that more than one lamp be on at the same time. Also, saying "after 1 second !L3" doesn't preclude L3 turning back on after two seconds, nor does it preclude L2 or L1 also being on at the same time for 1 second.

So I think a solution is the following (I simplified the example to not specify toggling mode):

  1. The sys shall immediately satisfy L1 & !L2 & !L3
  2. Upon L1 the sys shall for 1 sec satisfy L1 & !L2 & !L3
  3. Upon L2 the sys shall for 1 sec satisfy L2 & !L1 & !L3
  4. Upon L3 the sys shall for 1 sec satisfy L3 & !L1 & !L2
  5. Upon L1 the sys shall after 1 sec satisfy L2
  6. Upon L2 the sys shall after 1 sec satisfy L3
  7. Upon L3 the sys shall after 1 sec satisfy L1

I like using the word "upon" because it implies being triggered by the proposition becoming true from false.

tpressburger avatar Dec 08 '21 03:12 tpressburger

thanks a lot!

leesoons avatar Dec 08 '21 06:12 leesoons

I am closing this issue since the question has been answered.

anmavrid avatar Jan 04 '22 18:01 anmavrid