UNPKG

node-red-contrib-genetic-charging-strategy

Version:

A module for Node-RED that adds a battery charging strategy to node-red-contrib-power-saver. It uses genetic algorithms to find the best schedule

12 lines (11 loc) 532 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateRandomActivity = exports.random = void 0; const random = (min, max) => Math.floor(Math.random() * (max - min) + min); exports.random = random; const generateRandomActivity = (excludedValue) => { const randomArray = [-1, 0, 1].filter((val) => val !== excludedValue); const randomIndex = Math.floor(Math.random() * randomArray.length); return randomArray[randomIndex]; }; exports.generateRandomActivity = generateRandomActivity;