Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "client"

This module contains the MQTT client listener classes. They can be used to listen for events raised by the W.I.S.E. process using MQTT. Event types include scenario completion, simulation completion, and statistics.

Example

let wise = new WISE();
//********** setup your W.I.S.E. job here **********
//add some statistics to listen for. They will be emitted at
//the end of each timestep for all scenariosd
prom.timestepSettings.addStatistic(TimestepSettings.STATISTIC_SCENARIO_CURRENT_TIME);
prom.timestepSettings.addStatistic(TimestepSettings.STATISTIC_SCENARIO_NAME);
//start the job
let job = await wise.beginJobPromise();
//create a new manager to listen for events
let manager = new JobManager(job.name.replace(/^\s+|\s+$/g, ''));
//listen for new statistics events
manager.on('statisticsReceived', (args) => {
    //args will be of type StatisticsEventArgs
});
//listen for new scenario complete events
manager.on('scenarioComplete', (args) => {
    //args will be of type ScenarioCompleteEventArgs
});
//listen for new simulation complete events
manager.on('simulationComplete', (args) => {
    //args will be of type SimulationCompleteEventArgs
});

await manager.start(); //connect to the MQTT broker

Index