Skip to content

Commit 58c4005

Browse files
committed
Adding Microgrid Components and Microgrid Control Model
1 parent f752e8d commit 58c4005

439 files changed

Lines changed: 6278 additions & 47 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- name: Setup MATLAB
4747
uses: matlab-actions/setup-matlab@v2
4848
with:
49-
release: R2025a
49+
release: R2025b
5050
cache: true
5151
products: |
5252
Simulink
@@ -70,7 +70,7 @@ jobs:
7070
- name: Setup MATLAB
7171
uses: matlab-actions/setup-matlab@v2
7272
with:
73-
release: R2025a
73+
release: R2025b
7474
cache: true
7575
products: |
7676
Simulink
@@ -94,7 +94,7 @@ jobs:
9494
- name: Setup MATLAB
9595
uses: matlab-actions/setup-matlab@v2
9696
with:
97-
release: R2025a
97+
release: R2025b
9898
cache: true
9999
products: |
100100
Simulink
@@ -106,4 +106,28 @@ jobs:
106106
- name: Run tests
107107
uses: matlab-actions/run-command@v2
108108
with:
109-
command: openProject(pwd); TestRunnerTechnoEconomicAnalysis;
109+
command: openProject(pwd); TestRunnerTechnoEconomicAnalysis;
110+
111+
job-Microgrid-Control-unit-tests:
112+
runs-on: ubuntu-latest
113+
steps:
114+
115+
- name: Check out repository
116+
uses: actions/checkout@v4
117+
118+
- name: Setup MATLAB
119+
uses: matlab-actions/setup-matlab@v2
120+
with:
121+
release: R2025b
122+
cache: true
123+
products: |
124+
Simulink
125+
Simscape
126+
Simscape_Electrical
127+
Optimization_Toolbox
128+
Stateflow
129+
130+
- name: Run tests
131+
uses: matlab-actions/run-command@v2
132+
with:
133+
command: openProject(pwd); TestRunnerMicrogridControl;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Components/Harness/BESSGFLParam.m

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
% -------------------------------------------------------------------
2+
% Generated by MATLAB on 22-Oct-2025 14:42:08
3+
% MATLAB version: 25.1.0.3040723 (R2025a) Update 1
4+
% -------------------------------------------------------------------
5+
6+
7+
Ts = 5E-5;
8+
9+
Var = struct;
10+
Var.Gain = 5;
11+
Var.Offset = 3;
12+
13+
bessVoltage = 1500;
14+
15+
gflInverter = struct;
16+
gflInverter.activeDroop = 2;
17+
gflInverter.reactiveDroop = 1;
18+
gflInverter.ratedPower = 2.2E+6;
19+
gflInverter.baseImpedance = 0.2164;
20+
gflInverter.filterInductance = 0.00026526;
21+
gflInverter.iMaxPU = 1.2;
22+
gflInverter.sensorDelay = 0.001;
23+
gflInverter.kpId = 2;
24+
gflInverter.kiId = 200;
25+
gflInverter.frequency = 60;
26+
gflInverter.ratedVoltage = 690;
27+
28+
transformer = struct;
29+
transformer.powerRating = 1000;
30+
transformer.primaryRMSVoltage = 1000;
31+
transformer.secondaryRMSVoltage = 13800;
32+
transformer.PrimaryResistancePU = 0.02976;
33+
transformer.SecondaryResistancePU = 0.01984;
34+
transformer.PrimaryReactancePU = 0.07662;
35+
transformer.SecondaryReactancePU = 0.11493;
36+
transformer.ZeroSequenceReactancePU = 0.084282;
37+
38+
bessSystem.plantRating = 2000;%2200;
39+
bessSystem.frequency = 50;
40+
bessSystem.Vdc = 1500;
41+
bessSystem.filterInductance = 1e-5;
42+
bessSystem.filterResistance = 1e-3;
43+
bessSystem.switchingFrequency = 20;
44+
bessSystem.converterEfficiency = 100;
45+
bessSystem.iMaxPU = 1.2;
46+
bessSystem.minSOC = 0.1;
47+
bessSystem.maxSOC = 0.95;
48+
bessSystem.Vac = 690;

Components/Harness/BESSGFMParam.m

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
% -------------------------------------------------------------------
2+
% Generated by MATLAB on 22-Oct-2025 14:42:35
3+
% MATLAB version: 25.1.0.3040723 (R2025a) Update 1
4+
% -------------------------------------------------------------------
5+
6+
7+
Ts = 5E-5;
8+
9+
Var = struct;
10+
Var.Gain = 5;
11+
Var.Offset = 3;
12+
13+
bessVoltage = 1500;
14+
15+
gfmInverter = struct;
16+
%gfmInverter.apparentPower = 2e6;%2.2E+6;
17+
gfmInverter.frequency = 60;
18+
gfmInverter.DCVoltage = 1500;
19+
gfmInverter.lineRMSVoltage = 690;
20+
gfmInverter.SwitchFrequency = 10000;
21+
gfmInverter.measurementSampleTime = 5E-5;
22+
gfmInverter.droopControl = struct;
23+
gfmInverter.droopControl.freqSlopeMp = 0.01;
24+
gfmInverter.droopControl.lpfTimeConst = 0.015;
25+
gfmInverter.droopControl.T2 = 0.006;
26+
gfmInverter.droopControl.T1 = 0.005;
27+
gfmInverter.droopControl.sampleTime = 5E-5;
28+
gfmInverter.freqMeasTimeConst = 0.001;
29+
gfmInverter.vsm = struct;
30+
gfmInverter.vsm.inertiaConstant = 1;
31+
gfmInverter.vsm.dampingCoefficent = 20;%10.056;
32+
gfmInverter.vsm.freqDroop = 5;%10;
33+
gfmInverter.vsm.PmeasTimeConst = 0.001;
34+
gfmInverter.vsm.maxDampingPower = 0.9;
35+
gfmInverter.vsm.minDampingPower = -0.6;
36+
gfmInverter.vsm.samplingTime = 5E-5;
37+
gfmInverter.vsm.dampingPowerFreqOption = ...
38+
'Use Grid Frequency Measurement';
39+
gfmInverter.Qcontrol = struct;
40+
gfmInverter.Qcontrol.voltageDroop = 5;%0.5;%;3;
41+
gfmInverter.Qcontrol.QmeasTimeConst = 0.001;
42+
gfmInverter.Qcontrol.voltageReference = 1;
43+
gfmInverter.highSCRQControl = struct;
44+
gfmInverter.highSCRQControl.voltageDroop = 0.3;
45+
gfmInverter.highSCRQControl.QmeasTimeConst = 0.001;
46+
gfmInverter.highSCRQControl.voltageReference = 1;
47+
gfmInverter.ratedrmsCurrent = 577.35026918962581;
48+
gfmInverter.L = 0.0001325;
49+
gfmInverter.lineResistance = 0.08;
50+
gfmInverter.currentLimit = struct;
51+
gfmInverter.currentLimit.virImpResistanceCoeff = 0.1875;
52+
gfmInverter.currentLimit.virImpXbyR = 13.2;
53+
gfmInverter.currentLimit.viCurrentLimit = 1.2;
54+
gfmInverter.currentLimit.viFilterTimeConst = 0.001;
55+
gfmInverter.currentLimit.maxSaturationCurrent = 1.4;
56+
gfmInverter.currentLimit.maxSaturationDelay = 0.001;
57+
gfmInverter.currentLimit.satCurrentRunTime = 0.001;
58+
gfmInverter.controller = struct;
59+
gfmInverter.controller.CurrentControlSampleTime = 5E-5;
60+
gfmInverter.controller.ctControllerKp = 2;
61+
gfmInverter.controller.ctControllerKi = 10;
62+
gfmInverter.controller.VoltageControlSampleTime = 5E-5;
63+
gfmInverter.controller.voltControllerKp = 3;%3;
64+
gfmInverter.controller.voltControllerKi = 1.5;%1.5;
65+
gfmInverter.controller.voltageMaxId = 1.8;
66+
gfmInverter.controller.voltageMinId = -1.8;
67+
gfmInverter.controller.voltageMaxIq = 1.8;
68+
gfmInverter.controller.voltageMinIq = -1.8;
69+
gfmInverter.controller.voltMeasTimeConst = 0.005;
70+
71+
transformer = struct;
72+
transformer.powerRating = 1000;
73+
transformer.primaryRMSVoltage = 1000;
74+
transformer.secondaryRMSVoltage = 13800;
75+
transformer.PrimaryResistancePU = 0.02976;
76+
transformer.SecondaryResistancePU = 0.01984;
77+
transformer.PrimaryReactancePU = 0.07662;
78+
transformer.SecondaryReactancePU = 0.11493;
79+
transformer.ZeroSequenceReactancePU = 0.084282;
80+
81+
bessSystem.plantRating = 2000;%2200;
82+
bessSystem.frequency = 50;
83+
bessSystem.Vdc = 1500;
84+
bessSystem.filterInductance = 1e-5;
85+
bessSystem.filterResistance = 1e-3;
86+
bessSystem.switchingFrequency = 20;
87+
bessSystem.converterEfficiency = 100;
88+
bessSystem.iMaxPU = 1.2;
89+
bessSystem.activeDroop = 1e-4;
90+
bessSystem.reactiveDroop = 0.02;
91+
bessSystem.Vac = 690;
92+

Components/Harness/BESSParam.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BESSGFLParam;
2+
BESSGFMParam;
1.12 MB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
blackStart.voltageLevel = [0.4 0.4 0.2];
2+
blackStart.delayLevel = [1 1 1];
3+
blackStart.FRef = 60;
4+
blackStart.time = 3;

0 commit comments

Comments
 (0)