UNPKG

@corvina/device-client

Version:
84 lines 2.67 kB
import { AlarmDesc, SimulationDesc } from "../common/types"; declare enum StepSimulationState { STABLE = 0, TRANSITION = 1 } interface StepSimulationStateMachine { state: StepSimulationState; origin: number; target: number; current: number; duration: number; start: number; } export interface StepSimulationProperties extends SimulationDesc { amplitude: number; offset: number; easing: string; easingProps?: any; jump_probability: number; dt_min: number; dt_max: number; state?: StepSimulationStateMachine; } export interface SineSimulationProperties extends SimulationDesc { amplitude: number; offset: number; period: number; phase: number; } export interface FunctionSimulationProperties extends SimulationDesc { f: string; _f?: ($: any) => any; } export interface ConstSimulationProperties extends SimulationDesc { value: number; } interface AbstractSimulator { loop(): any; } export declare class BaseSimulator implements AbstractSimulator { tag: string; depsOut: Map<string, BaseSimulator>; value: any; lastSentValue: any; static simulators: BaseSimulator[]; static simulatorsByTagName: Map<string, BaseSimulator>; static inited: boolean; static sorted: boolean; static intervalID: any; static filterDuplications: boolean; static simulationMs: number; constructor(tag: string); static $: (source: BaseSimulator, tagName: string) => any; loop(): void; } export declare class DataSimulator extends BaseSimulator { private callback; type: string; desc: SimulationDesc; private defAmplitude; private defPhase; private defPeriod; constructor(tag: string, type: string, callback: (tagName: string, value: number, ts: number) => Promise<boolean>, desc: SimulationDesc); applyNoise(v: number | boolean | string, min?: number, max?: number): number | boolean | string; nullify(v: any, callback?: (nullifyingPrev: boolean, nullifyingCurrent: boolean) => void): any; loop(): Promise<void>; static clear(): void; } export declare class AlarmSimulator extends BaseSimulator { private callback; private alarm; private alarmData; private tagRefs; static alarmSimulatorMapkey(alarmName: string): string; constructor(alarm: AlarmDesc, callback: (AlarmData: any) => Promise<boolean>); acknowledge(evTs: number, user: string, comment: string): void; reset(evTs: number, user: string, comment: string): void; disable(): void; enable(): void; private propagate; loop(): Promise<void>; } export {}; //# sourceMappingURL=simulation.d.ts.map