show timestamp of next timeout

This commit is contained in:
Joeri Exelmans 2025-10-13 11:35:42 +02:00
parent f7f3923131
commit e233fa9166
4 changed files with 40 additions and 11 deletions

View file

@ -1,7 +1,7 @@
import { evalExpr } from "./actionlang_interpreter";
import { computeArena, ConcreteState, getDescendants, isOverlapping, OrState, Statechart, stateDescription, Transition } from "./ast";
import { Action } from "./label_ast";
import { Environment, RaisedEvents, Mode, RT_Statechart, initialRaised, BigStepOutput } from "./runtime_types";
import { Environment, RaisedEvents, Mode, RT_Statechart, initialRaised, BigStepOutput, TimerElapseEvent, Timers } from "./runtime_types";
export function initialize(ast: Statechart): BigStepOutput {
let {enteredStates, environment, ...raised} = enterDefault(0, ast.root, {
@ -17,9 +17,6 @@ type ActionScope = {
type EnteredScope = { enteredStates: Mode } & ActionScope;
type TimerElapseEvent = {state: string, timeDurMs: number};
type Timers = [number, TimerElapseEvent][];
export function entryActions(simtime: number, state: ConcreteState, actionScope: ActionScope): ActionScope {
for (const action of state.entryActions) {
(actionScope = execAction(action, actionScope));

View file

@ -27,9 +27,13 @@ export type RaisedEvents = {
outputEvents: string[];
};
export type Timers = Map<string, number>; // transition uid -> timestamp
// export type Timers = Map<string, number>; // transition uid -> timestamp
export const initialRaised: RaisedEvents = {
internalEvents: [],
outputEvents: [],
};
export type TimerElapseEvent = { state: string; timeDurMs: number; };
export type Timers = [number, TimerElapseEvent][];