Skip to content

Commit 9a7febd

Browse files
committed
Update/complement the example script
1 parent ca30baf commit 9a7febd

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed

examples/13Bus.zip

650 Bytes
Binary file not shown.

examples/13Bus/run.m

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
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+
124
%% Path setup
225
% If you have not already added DSS_MATLAB to your MATLAB path, you can
326
% use a command like one of the following -- adjust path as necessary:
@@ -47,7 +70,7 @@
4770

4871
% And plot the voltages for each node
4972
figure;
50-
plot(1:Circuit.NumNodes, Circuit.AllBusVmagPu, 'o')
73+
plot(1:Circuit.NumNodes, Circuit.AllBusVmagPu, 'o-')
5174

5275
xlabel('Node number');
5376
ylabel('Voltage (pu)');
@@ -66,7 +89,7 @@
6689

6790
idx = Load.First;
6891
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);
7093
idx = Load.Next;
7194
end
7295

@@ -92,3 +115,31 @@
92115
ylabel('Bus Y coordinate');
93116
ylabel(handle, 'Voltage (pu)');
94117

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

Comments
 (0)