X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.js;h=3e0f9bfcdfc73ab236e6ac7daf6a8609ef0875e6;hb=a07b4408ab12a39d84ec080c79ee06fe7a06bdeb;hp=be4f161380c6fad845520e4cb2b5139fe79fd621;hpb=d20c21a0906551f6d22f07688ca2cd9b10bbd84b;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.js b/src/charging-station/ChargingStation.js index be4f1613..3e0f9bfc 100644 --- a/src/charging-station/ChargingStation.js +++ b/src/charging-station/ChargingStation.js @@ -95,6 +95,9 @@ class ChargingStation { logger.debug(this._basicFormatLog() + ' Template file ' + this._stationTemplateFile + ' have changed, reload'); // Initialize this._initialize(); + this._addConfigurationKey('HeartBeatInterval', Utils.convertToInt(this._heartbeatInterval ? this._heartbeatInterval : 0)); + this._addConfigurationKey('HeartbeatInterval', Utils.convertToInt(this._heartbeatInterval ? this._heartbeatInterval : 0), false, false); + this._addConfigurationKey('NumberOfConnectors', this._getMaxConnectors(), true); } catch (error) { logger.error(this._basicFormatLog() + ' Charging station template file monitoring error: ' + error); } @@ -440,13 +443,7 @@ class ChargingStation { this._connectors[lastConnector] = connectorsConfig[lastConnector]; } } - let maxConnectors = 0; - if (Array.isArray(this._stationInfo.numberOfConnectors)) { - // Generate some connectors - maxConnectors = this._stationInfo.numberOfConnectors[(this._index - 1) % this._stationInfo.numberOfConnectors.length]; - } else { - maxConnectors = this._stationInfo.numberOfConnectors; - } + const maxConnectors = this._getMaxConnectors(); this._addConfigurationKey('NumberOfConnectors', maxConnectors, true); // Generate all connectors for (let index = 1; index <= maxConnectors; index++) { @@ -835,6 +832,17 @@ class ChargingStation { _getConnector(number) { return this._stationInfo.Connectors[number]; } + + _getMaxConnectors() { + let maxConnectors = 0; + if (Array.isArray(this._stationInfo.numberOfConnectors)) { + // Generate some connectors + maxConnectors = this._stationInfo.numberOfConnectors[(this._index - 1) % this._stationInfo.numberOfConnectors.length]; + } else { + maxConnectors = this._stationInfo.numberOfConnectors; + } + return maxConnectors; + } } module.exports = ChargingStation;