fix two timers bugs
This commit is contained in:
parent
1470a99665
commit
1660b06064
3 changed files with 9 additions and 3 deletions
|
|
@ -279,7 +279,7 @@ function attemptSrcState(simtime: number, sourceState: AbstractState, event: RT_
|
|||
else {
|
||||
// get transitions triggered by timeout
|
||||
triggered = labels.filter(([_t,l]) =>
|
||||
l.trigger.kind === "after" && l.trigger.durationMs === event.timeDurMs);
|
||||
l.trigger.kind === "after" && sourceState.uid === event.state && l.trigger.durationMs === event.timeDurMs);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,13 @@ export function statechartExecution(ast: Statechart): TimedReactive<BigStep> {
|
|||
const bigstep = initialize(ast);
|
||||
return [bigstep.outputEvents, bigstep];
|
||||
},
|
||||
timeAdvance: (c: RT_Statechart) => (c.environment.get("_timers") as Timers)[0]?.[0] || Infinity,
|
||||
timeAdvance: (c: RT_Statechart) => {
|
||||
const timers = c.environment.get("_timers");
|
||||
if (timers && timers[0]) {
|
||||
return timers[0][0];
|
||||
}
|
||||
return Infinity;
|
||||
},
|
||||
intTransition: (c: RT_Statechart) => {
|
||||
const timers = c.environment.get("_timers") as Timers;
|
||||
if (timers.length === 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue