Skip to content

Commit 85e1bd2

Browse files
authored
Correct formulas for switchedOnQAtNominalV and switchedOnSusceptance (#58)
Signed-off-by: achour94 <[email protected]>
1 parent b72b11c commit 85e1bd2

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
2+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
3+
<changeSet author="berrahmaach" id="correct-shunt-compensator-formulas-switchedOnQAtNominalV">
4+
<comment>Correct switchedOnQAtNominalV formula - replace incorrect formula with the correct one</comment>
5+
<sql dbms="postgresql">
6+
UPDATE spreadsheet_column
7+
SET formula = '(maxQAtNominalV / maximumSectionCount) * sectionCount'
8+
WHERE column_id = 'switchedOnQAtNominalV'
9+
AND formula = 'maxQAtNominalV / maximumSectionCount';
10+
</sql>
11+
</changeSet>
12+
13+
<changeSet author="berrahmaach" id="correct-shunt-compensator-formulas-switchedOnSusceptance">
14+
<comment>Correct switchedOnSusceptance formula - replace incorrect formula with the correct one</comment>
15+
<sql dbms="postgresql">
16+
UPDATE spreadsheet_column
17+
SET formula = '(maxSusceptance / maximumSectionCount) * sectionCount'
18+
WHERE column_id = 'switchedOnSusceptance'
19+
AND formula = 'maxSusceptance / maximumSectionCount';
20+
</sql>
21+
</changeSet>
22+
23+
<changeSet author="berrahmaach" id="update-section-count-columns-precision">
24+
<comment>Update precision to 0 for maximumSectionCount and sectionCount columns where precision is null</comment>
25+
<sql dbms="postgresql">
26+
UPDATE spreadsheet_column
27+
SET precision = 0
28+
WHERE column_id IN ('maximumSectionCount', 'sectionCount')
29+
AND precision IS NULL;
30+
</sql>
31+
</changeSet>
32+
</databaseChangeLog>

src/main/resources/db/changelog/db.changelog-master.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ databaseChangeLog:
5656
- include:
5757
file: changesets/changelog_20250606T123216Z.xml
5858
relativeToChangelogFile: true
59+
- include:
60+
file: changesets/changelog_20250616T090000Z.xml
61+
relativeToChangelogFile: true

src/main/resources/default-spreadsheet-config-collection.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,15 +1313,15 @@
13131313
{
13141314
"name": "Maximum number of sections",
13151315
"type": "NUMBER",
1316-
"precision": null,
1316+
"precision": 0,
13171317
"formula": "maximumSectionCount",
13181318
"dependencies": null,
13191319
"id": "maximumSectionCount"
13201320
},
13211321
{
13221322
"name": "Current number of sections",
13231323
"type": "NUMBER",
1324-
"precision": null,
1324+
"precision": 0,
13251325
"formula": "sectionCount",
13261326
"dependencies": null,
13271327
"id": "sectionCount"
@@ -1338,7 +1338,7 @@
13381338
"name": "Switch-on Q at nominal voltage",
13391339
"type": "NUMBER",
13401340
"precision": 1,
1341-
"formula": "maxQAtNominalV / maximumSectionCount",
1341+
"formula": "(maxQAtNominalV / maximumSectionCount) * sectionCount",
13421342
"dependencies": null,
13431343
"id": "switchedOnQAtNominalV"
13441344
},
@@ -1354,7 +1354,7 @@
13541354
"name": "Switch-on susceptance",
13551355
"type": "NUMBER",
13561356
"precision": 5,
1357-
"formula": "maxSusceptance / maximumSectionCount",
1357+
"formula": "(maxSusceptance / maximumSectionCount) * sectionCount",
13581358
"dependencies": null,
13591359
"id": "switchedOnSusceptance"
13601360
},

0 commit comments

Comments
 (0)