Opened 9 years ago
Last modified 9 years ago
#3523 accepted enhancement
Add valFirst and valLast to retrieve the first and last value of a variable at given time
Reported by: | Adrian Pop | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Interactive Environment | Version: | |
Keywords: | Cc: | Bernhard Thiele |
Description
When we have events we have several values in the result file.
We need an API like val but which returns the first value or the last value.
Change History (6)
comment:1 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:2 by , 9 years ago
Type: | defect → enhancement |
---|
comment:3 by , 9 years ago
comment:4 by , 9 years ago
The enhancement proposal is motivated by writing tests for clocked synchronous models. In that case, one knows the exact time of the event (at least for periodic clocks, although there can be practical problems due to floating point precision). In the current result file one gets two values at the time instants in which a clock is active, the LHS value and the RHS value of a variable at the "event". The RHS value is the value that needs to be checked.
comment:5 by , 9 years ago
You are using doubles though. Are you sure you can get the exact value? A 1/7 Hz frequency for example would be hard to get right.
comment:6 by , 9 years ago
No, we can't get the exact value and doing it like proposed above has limitations. However, it would be a quick preliminary improvement to have that enhancement. The question is whether one can come up with something better with limited efforts?
This only makes sense to use if you know the exact time of the event. Otherwise, your time will be either to the left or the right of the event. Anyway, it would be simpler to have a boolean or enum as an argument to val (with a default value) than it would be to add two new API functions.