Skip to content

Commit

Permalink
fix: updated names
Browse files Browse the repository at this point in the history
  • Loading branch information
enell committed Dec 26, 2022
1 parent 411bbaf commit 2a9c2af
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
],
"node-red": {
"nodes": {
"enell-strategy-battery-charging": "src/strategy-battery-charging.js"
"enell-strategy-genetic-charging": "src/strategy-battery-charging.js"
},
"version": ">=2.2.0"
},
Expand Down
36 changes: 18 additions & 18 deletions src/strategy-battery-charging.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,52 +42,52 @@
},
inputs: 1,
outputs: 1,
icon: "font-awsome/fa-battery-3",
icon: "font-awesome/fa-battery",
label: function () {
return this.name || "Genetic charging schedule";
return this.name || "Battery charging schedule";
}
});
</script>

<script type="text/html" data-template-name="enell-strategy-genetic-charging">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"></input>
<label for="node-input-name" style="width: 240px"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"/>
</div>
<h3>Energy settings</h3>
<div class="form-row">
<label for="node-input-batteryMaxEnergy"><i class="fa fa-tag"></i> Battery capacity (kWh)</label>
<input type="text" id="node-input-batteryMaxEnergy"></input>
<label for="node-input-batteryMaxEnergy" style="width: 240px">Battery capacity (kWh)</label>
<input type="text" id="node-input-batteryMaxEnergy"/>
</div>

<div class="form-row">
<label for="node-input-batteryMaxInputPower"><i class="fa fa-tag"></i> Max battery input power (kW)</label>
<input type="text" id="node-input-batteryMaxInputPower"></input>
<label for="node-input-batteryMaxInputPower" style="width: 240px">Max battery input power (kW)</label>
<input type="text" id="node-input-batteryMaxInputPower"/>
</div>

<div class="form-row">
<label for="node-input-averageConsumption"><i class="fa fa-tag"></i> Household average consumption per hour (kW)</label>
<input type="text" id="node-input-averageConsumption"></input>
<label for="node-input-averageConsumption" style="width: 240px">Average consumption per hour (kW)</label>
<input type="text" id="node-input-averageConsumption"/>
</div>
<h3>Genetic algorithm</h3>
<div class="form-row">
<label for="node-input-populationSize"><i class="fa fa-tag"></i> Population size</label>
<input type="text" id="node-input-populationSize"></input>
<label for="node-input-populationSize" style="width: 240px">Population size</label>
<input type="text" id="node-input-populationSize"/>
</div>

<div class="form-row">
<label for="node-input-generations"><i class="fa fa-tag"></i> Number of generations</label>
<input type="text" id="node-input-generations"></input>
<label for="node-input-generations" style="width: 240px">Number of generations</label>
<input type="text" id="node-input-generations"/>
</div>

<div class="form-row">
<label for="node-input-mutationRate"><i class="fa fa-tag"></i> Mutation chance (%)</label>
<input type="text" id="node-input-mutationRate"></input>
<label for="node-input-mutationRate" style="width: 240px">Mutation chance (%)</label>
<input type="text" id="node-input-mutationRate"/>
</div>

<div class="form-row">
<label for="node-input-numberOfPricePeriods"><i class="fa fa-tag"></i> Max number of charging/dicharging periods to simulate</label>
<input type="text" id="node-input-numberOfPricePeriods"></input>
<label for="node-input-numberOfPricePeriods" style="width: 240px">Number of charging/discharging periods</label>
<input type="text" id="node-input-numberOfPricePeriods"/>
</div>
</script>

Expand Down
15 changes: 4 additions & 11 deletions src/strategy-battery-charging.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const { calculateBatteryChargingStrategy } = require('./strategy-battery-charging-functions')
const {
calculateBatteryChargingStrategy,
} = require('./strategy-battery-charging-functions')

module.exports = function (RED) {
RED.nodes.registerType('enell-strategy-battery-charging', function (config) {
RED.nodes.registerType('enell-strategy-genetic-charging', function (config) {
RED.nodes.createNode(this, config)

const {
Expand All @@ -14,15 +16,6 @@ module.exports = function (RED) {
batteryMaxInputPower,
averageConsumption,
} = config
// const populationSize = 20
// const numberOfPricePeriods = 8
// const generations = 400
// const mutationRate = 0.03

// const batteryMaxEnergy = 5 //kWh
// const batteryMaxOutputPower = 2.5 //kW
// // const batteryMaxInputPower = 2.5 //kW
// const averageConsumption = 1.5 // kW

this.on('input', async (msg, send, done) => {
const priceData = msg.payload?.priceData || []
Expand Down
13 changes: 10 additions & 3 deletions test/strategy-battery-charging.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ describe('Battery charging strategy Node', () => {
})

it('should be loaded', (done) => {
var flow = [{ id: 'n1', type: 'enell-strategy-battery-charging', name: 'test name' }]
var flow = [
{ id: 'n1', type: 'enell-strategy-genetic-charging', name: 'test name' },
]

helper.load(node, flow, function () {
var n1 = helper.getNode('n1')
Expand All @@ -20,7 +22,7 @@ describe('Battery charging strategy Node', () => {
var flow = [
{
id: 'n1',
type: 'enell-strategy-battery-charging',
type: 'enell-strategy-genetic-charging',
name: 'test name',
populationSize: 10,
numberOfPricePeriods: 3,
Expand Down Expand Up @@ -58,7 +60,12 @@ describe('Battery charging strategy Node', () => {

it('should send handle empty priceData', (done) => {
var flow = [
{ id: 'n1', type: 'enell-strategy-battery-charging', name: 'test name', wires: [['n2']] },
{
id: 'n1',
type: 'enell-strategy-genetic-charging',
name: 'test name',
wires: [['n2']],
},
{ id: 'n2', type: 'helper' },
]
helper.load(node, flow, function () {
Expand Down

0 comments on commit 2a9c2af

Please sign in to comment.