Skip to content

Commit

Permalink
feat: Implement Balancing Group Management with Contract & MeritOrder…
Browse files Browse the repository at this point in the history
… Services

- Added Contract service for managing delivery contracts at a balancing point.
- Introduced MeritOrder service to prioritize conflicting contracts efficiently.
- Enabled Balancing service to seal product balances with MeritOrder transaction integration based on contract rules.
  • Loading branch information
zoernert committed Jan 25, 2024
1 parent 3ccb85a commit 62b2ffe
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 523 deletions.
2 changes: 1 addition & 1 deletion framework/.releaserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
{type: 'increment', release: 'patch'},
{type: 'Increment', release: 'patch'},
{type: 'feat', release: 'patch'},
{type: 'Feat', release: 'patch'},
{type: 'Feat', release: 'minor'},
{type: 'fix', release: 'patch'},
{type: 'Fix', release: 'patch'},
{type: 'docs', release: 'patch'},
Expand Down
30 changes: 29 additions & 1 deletion framework/services/balancing.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,28 @@ module.exports = {
return decoded;
}
},
isSealed: {
params: {
assetId: { type: "string" },
epoch: { type: "any" }
},
rest: {
method: "GET",
path: "/balance"
},
async handler(ctx) {
let res= await ctx.call("balances_sealed_model.find", {
query: {
assetId: ctx.params.assetId,
epoch: ctx.params.epoch * 1,
seal: {$exists: true}
}
});
if(res.length == 0) {
return false;
} else return true;
}
},
balance: {
params: {
assetId: { type: "string" },
Expand Down Expand Up @@ -459,6 +481,8 @@ module.exports = {
energy: energybalance,
co2eq: co2eqbalance
}
balance = await ctx.call("meritorder.probeBalance",balance);

return balance;
}
},
Expand Down Expand Up @@ -497,7 +521,11 @@ module.exports = {
label: ".end"
}
await ctx.call("balance_settlements_active_model.insert",{entity:statement});
intermediateBalance = await ctx.call("balancing.unsealedBalance",ctx.params);
intermediateBalance = await ctx.call("balancing.unsealedBalance",ctx.params); // Hier könnte man die MOL danach abrufen

// TODO: Handover info that balance will be sealed.
intermediateBalance.seal = true;
await ctx.call("meritorder.process",intermediateBalance); // different to unsealedBalance Call! Just booking
}
if((intermediateBalance.energy == 0)||(intermediateBalance.clearing.energy == 0)) {
let seal_content = {
Expand Down
Loading

0 comments on commit 62b2ffe

Please sign in to comment.