There are two ways to generate future events:
- using a DEIOPort and its send(int, Token, double) method to create an event in the future. This event cannot be cancelled. - using fireAt() to request a refiring at a future time and then when that refiring occurs, sending the output at the current time. This can be easily cancelled.
Very few actors use the first method, but some of the delay actors are among them. I don't like the first method, and am considering deprecating it. The delay actors should be redone to use the second method, and I think that having a cancel port would be an excellent idea... Perhaps you would like to take a stab at making this change for VariableDelay?
Edward
At 01:29 PM 9/26/2003 -0400, [EMAIL PROTECTED] wrote:
Hi,
I'm interested in cancelling a particular discrete event that has already been scheduled. Can this be done?
An example: I'm modeling a car moving on a highway in discrete steps from speed sign to speed sign. The car moves at the posted speed of the previous sign. At each speed sign the time required to reach the next sign is computed, and a delay equal to that time instantiated. But what if some asynchronous thing happens like the sudden appearance of a radar trap between signs, prior to when I will read that location. I will need to slow down, so I have a new event at the speed lign location. But, my previously calculated time-to-travel to the next sign is no longer valid: my speed has changed. I can schedule a new delay, but how do I cancel the already scheduled event?
I don't see any methods in the DEDirector to cancel a specific future event, even if there was some way to precisely identify it.
>From an actor point-of-view, it would be nice if the variableDelay actor in the library had an additional input port labelled "cancel" which cancelled the pending event.
Thanks!
---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]
------------ Edward A. Lee, Professor 518 Cory Hall, UC Berkeley, Berkeley, CA 94720 phone: 510-642-0455, fax: 510-642-2739 [EMAIL PROTECTED], http://ptolemy.eecs.berkeley.edu/~eal
---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]