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 Adrian Pop, 9 years ago

Owner: changed from somebody to Adrian Pop
Status: newaccepted

comment:2 by Adrian Pop, 9 years ago

Type: defectenhancement

comment:3 by Martin Sjölund, 9 years ago

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.

comment:4 by Bernhard Thiele, 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 Martin Sjölund, 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 Bernhard Thiele, 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?

Note: See TracTickets for help on using tickets.