41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
module.exports = function(RED) {
|
|
function reactor(config) {
|
|
RED.nodes.createNode(this, config);
|
|
var node = this;
|
|
|
|
let name = config.name;
|
|
|
|
const Reactor = require('./dependencies/reactor_class');
|
|
|
|
const reactor = new Reactor(
|
|
config.volume,
|
|
[
|
|
config.S_O_init,
|
|
config.S_I_init,
|
|
config.S_S_init,
|
|
config.S_NH_init,
|
|
config.S_N2_init,
|
|
config.S_NO_init,
|
|
config.S_HCO_init,
|
|
config.X_I_init,
|
|
config.X_S_init,
|
|
config.X_H_init,
|
|
config.X_STO_init,
|
|
config.X_A_init,
|
|
config.X_TS_init
|
|
]
|
|
);
|
|
|
|
node.on('input', function(msg, send, done) {
|
|
if (msg.topic == "clock") {
|
|
reactor.updateState(msg);
|
|
}
|
|
|
|
if (done) {
|
|
done();
|
|
}
|
|
});
|
|
}
|
|
RED.nodes.registerType("advanced-reactor", reactor);
|
|
};
|