|
| 1 | +%% About |
| 2 | + |
| 3 | +% This is just a simple example to illustrate the basic usage of the |
| 4 | +% package. DSS_MATLAB is intended to be a drop-in replacement to the |
| 5 | +% official OpenDS COM module distributed by EPRI. Since this uses an |
| 6 | +% alternative engine, it is not supported by EPRI, yet it's very |
| 7 | +% compatible, while being available on Windows, Linux, and macOS, and |
| 8 | +% containing several extensions and code optimizations. |
| 9 | +% |
| 10 | +% For links to docs and more, visit: https://dss-extensions.org/ |
| 11 | +% |
| 12 | +% If you just want the sample/test circuits, you can grab: |
| 13 | +% |
| 14 | +% https://github.com/dss-extensions/electricdss-tst/archive/refs/heads/master.zip |
| 15 | +% |
| 16 | +% Feedback is welcome either at the repository: |
| 17 | +% |
| 18 | +% https://github.com/dss-extensions/dss_matlab |
| 19 | +% |
| 20 | +% or at the Discussion page (created on March 2023): |
| 21 | +% |
| 22 | +% https://github.com/orgs/dss-extensions/discussions |
| 23 | + |
1 | 24 | %% Path setup
|
2 | 25 | % If you have not already added DSS_MATLAB to your MATLAB path, you can
|
3 | 26 | % use a command like one of the following -- adjust path as necessary:
|
|
47 | 70 |
|
48 | 71 | % And plot the voltages for each node
|
49 | 72 | figure;
|
50 |
| -plot(1:Circuit.NumNodes, Circuit.AllBusVmagPu, 'o') |
| 73 | +plot(1:Circuit.NumNodes, Circuit.AllBusVmagPu, 'o-') |
51 | 74 |
|
52 | 75 | xlabel('Node number');
|
53 | 76 | ylabel('Voltage (pu)');
|
|
66 | 89 |
|
67 | 90 | idx = Load.First;
|
68 | 91 | while idx ~= 0
|
69 |
| - fprintf('Load %s - rated power: %g kW, %g kvar', Load.Name, Load.kW, Load.kvar); |
| 92 | + fprintf('Load %s - rated power: %g kW, %g kvar\n', Load.Name, Load.kW, Load.kvar); |
70 | 93 | idx = Load.Next;
|
71 | 94 | end
|
72 | 95 |
|
|
92 | 115 | ylabel('Bus Y coordinate');
|
93 | 116 | ylabel(handle, 'Voltage (pu)');
|
94 | 117 |
|
| 118 | +%% Loading circuits from ZIP files (API extension, not available in the official OpenDSS) |
| 119 | + |
| 120 | +DSS.ClearAll(); |
| 121 | +ZIP = DSS.ZIP; |
| 122 | +ZIP.Open('../13Bus.zip') |
| 123 | + |
| 124 | +ZIP.List() |
| 125 | + |
| 126 | +% Running the DSS script directly from the ZIP. |
| 127 | +% This also restricts loading most files only from the ZIP archive, |
| 128 | +% so you have to use relative paths. |
| 129 | +ZIP.Redirect('13Bus/IEEE13Nodeckt.dss') |
| 130 | + |
| 131 | +ZIP.Close() |
| 132 | + |
| 133 | +DSS.ActiveCircuit.NumBuses |
| 134 | + |
| 135 | +%% Activating "AdvancedTypes" (API extension, not available in the official OpenDSS) |
| 136 | + |
| 137 | +DSS.AdvancedTypes = true; |
| 138 | + |
| 139 | +% This is now a complex array, instead of the classic pair-of-reals array |
| 140 | +Circuit.AllBusVolts |
| 141 | + |
| 142 | +% Other data will also be complex, and in matrix form: |
| 143 | +Circuit.Lines.First; |
| 144 | +Circuit.Lines.Name |
| 145 | +Circuit.Lines.Yprim |
0 commit comments