CIF simulator trace input mode: add commands to allow assigning new values to input variables
Idea
The idea is to add input
commands to trace input files, that allow assigning new values to input variables. So, something like:
input <input_var1>=<some_value>, <input_var2>=<some_value>, ...
event e
input <input_var1>=<some_value>, <input_var3>=<some_value>, ...
event e
Currently, input variables can only be assigned initial values, meaning they remain constant for the rest of the simulation. Since input variables are variables that are given a value by the environment of the model, the trace input file could play that role, providing new values at relevant times. This would conceptually fit the concepts we already have.
This would be similar to #227, but then for letting the trace input do updates rather than clicks on an SVG image.
Original issue description
Original title: "Trace input mode: possibility to update variables to use actual data within simulation"
Greetings,
I would like to suggest a possible enhancement for the trace input mode. Currently, this modality permits only to specify the sequence of events that happen during the simulation. However, I was wondering if it would be possible to extend such feature to allow, alongside events, to specify a new value for certain variables. To explain better the situation, let me use an example.
Suppose I have an automaton describing a plant which updates its state variable using transitions under a certain event and using data collected from some sensors. Now, I already have collected such data from my experiments and I would like to use them inside my model, so that when a transition occurs, my automaton evolves as if it was in a real context. To do so, I would like to write a trace file specifying, alongside the event's sequence, the values for the data I've collected to feed them to my automaton.
Ideally, the syntax of the trace file would be something like this:event e <var_1>:= <value_1>,...,<var_n>:= <value_n>
where <var_i>
indicates a variable within an automaton, and <value_i>
represents the actual data I have obtained throughout my experiment for that specific variable at this point of the simulation. Obviously, variables which are not specified keep their previous value. It is important to note, however, that such updates must have priority over ones triggered by event e
since it is likely that these latter will need to use newly assigned values (otherwise, I would update my variables using 'old' readings, i.e. from a previous event).
Do you think it could be useful to add such a feature?