Skip to content

time:schedule-event should handle times less than one millisecond in the future #53

@SFRailsback

Description

@SFRailsback

time:schedule-event takes an argument that is the future time at which the event is to be scheduled. When ticks are associated with logotimes (via time:anchor-schedule), then this argument can be a logotime.

When that logotime is less than one millisecond past the current time, schedule-event raises an error, saying that you tried to schedule an event in the past. We ought to be able to catch and prevent this error, and instead put the event at the top of the event queue so it is next for execution.

This problem is important because it is standard in discrete event simulation to use random-exponential to determine the time between events, and random-exponential often produces very small values.

The Library model Distribution Center Discrete Event Simulator provides an example, at lines 166-170. The commented-out statement
time:schedule-event "observer" [ -> receive-an-order ] time:plus sim-time time-to-next-order "minutes"
would always work if this problem was fixed, but it currently raises an error occasionally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions