Skip to content

Commit 83beedd

Browse files
committed
Populate with a first working version (tested on Windows only).
1 parent cf07d86 commit 83beedd

Some content is hidden

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

59 files changed

+16714
-0
lines changed

+DSS_MATLAB/Base.m

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
classdef Base < handle & matlab.mixin.CustomDisplay
2+
methods (Access = protected)
3+
function propgrp = getPropertyGroups(obj)
4+
propgrp = matlab.mixin.util.PropertyGroup();
5+
end
6+
7+
function header = getHeader(obj)
8+
if ~isscalar(obj)
9+
header = getHeader@matlab.mixin.CustomDisplay(obj);
10+
else
11+
headerStr = matlab.mixin.CustomDisplay.getClassNameForHeader(obj);
12+
headerStr = [headerStr,' (DSS MATLAB interface class)'];
13+
header = sprintf('%s\n',headerStr);
14+
end
15+
end
16+
end
17+
methods
18+
function obj = CheckForError(obj)
19+
error = calllib('dss_capi_v7', 'Error_Get_Number');
20+
if error ~= 0
21+
ME = MException(['DSS_MATLAB:Error' int2str(error)], calllib('dss_capi_v7', 'Error_Get_Description'));
22+
throw(ME);
23+
end
24+
end
25+
end
26+
end

+DSS_MATLAB/IActiveClass.m

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
classdef (CaseInsensitiveProperties) IActiveClass < DSS_MATLAB.Base
2+
% IActiveClass: DSS MATLAB interface class to DSS C-API
3+
%
4+
% Properties:
5+
% ActiveClassName - (read-only) Returns name of active class.
6+
% AllNames - (read-only) Array of strings consisting of all element names in the active class.
7+
% Count - (read-only) Number of elements in Active Class. Same as NumElements Property.
8+
% First - (read-only) Sets first element in the active class to be the active DSS object. If object is a CktElement, ActiveCktELment also points to this element. Returns 0 if none.
9+
% Name - Name of the Active Element of the Active Class
10+
% Next - (read-only) Sets next element in active class to be the active DSS object. If object is a CktElement, ActiveCktElement also points to this element. Returns 0 if no more.
11+
% NumElements - (read-only) Number of elements in this class. Same as Count property.
12+
13+
properties
14+
ActiveClassName
15+
AllNames
16+
Count
17+
First
18+
Name
19+
Next
20+
NumElements
21+
end
22+
23+
methods
24+
25+
function result = get.ActiveClassName(obj)
26+
% (read-only) Returns name of active class.
27+
result = calllib('dss_capi_v7', 'ActiveClass_Get_ActiveClassName');
28+
end
29+
30+
function result = get.AllNames(obj)
31+
% (read-only) Array of strings consisting of all element names in the active class.
32+
result = DSS_MATLAB.get_string_array('ActiveClass_Get_AllNames');
33+
end
34+
35+
function result = get.Count(obj)
36+
% (read-only) Number of elements in Active Class. Same as NumElements Property.
37+
result = calllib('dss_capi_v7', 'ActiveClass_Get_Count');
38+
end
39+
40+
function result = get.First(obj)
41+
% (read-only) Sets first element in the active class to be the active DSS object. If object is a CktElement, ActiveCktELment also points to this element. Returns 0 if none.
42+
result = calllib('dss_capi_v7', 'ActiveClass_Get_First');
43+
end
44+
45+
function result = get.Name(obj)
46+
% Name of the Active Element of the Active Class
47+
result = calllib('dss_capi_v7', 'ActiveClass_Get_Name');
48+
end
49+
function obj = set.Name(obj, Value)
50+
calllib('dss_capi_v7', 'ActiveClass_Set_Name', Value);
51+
obj.CheckForError();
52+
end
53+
54+
function result = get.Next(obj)
55+
% (read-only) Sets next element in active class to be the active DSS object. If object is a CktElement, ActiveCktElement also points to this element. Returns 0 if no more.
56+
result = calllib('dss_capi_v7', 'ActiveClass_Get_Next');
57+
end
58+
59+
function result = get.NumElements(obj)
60+
% (read-only) Number of elements in this class. Same as Count property.
61+
result = calllib('dss_capi_v7', 'ActiveClass_Get_NumElements');
62+
end
63+
end
64+
end

+DSS_MATLAB/IBus.m

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
classdef (CaseInsensitiveProperties) IBus < DSS_MATLAB.Base
2+
% IBus: DSS MATLAB interface class to DSS C-API
3+
%
4+
% Properties:
5+
% Coorddefined - (read-only) False=0 else True. Indicates whether a coordinate has been defined for this bus
6+
% CplxSeqVoltages - (read-only) Complex Double array of Sequence Voltages (0, 1, 2) at this Bus.
7+
% Cust_Duration - (read-only) Accumulated customer outage durations
8+
% Cust_Interrupts - (read-only) Annual number of customer-interruptions from this bus
9+
% Distance - (read-only) Distance from energymeter (if non-zero)
10+
% Int_Duration - (read-only) Average interruption duration, hr.
11+
% Isc - (read-only) Short circuit currents at bus; Complex Array.
12+
% Lambda - (read-only) Accumulated failure rate downstream from this bus; faults per year
13+
% N_Customers - (read-only) Total numbers of customers served downline from this bus
14+
% N_interrupts - (read-only) Number of interruptions this bus per year
15+
% Name - (read-only) Name of Bus
16+
% Nodes - (read-only) Integer Array of Node Numbers defined at the bus in same order as the voltages.
17+
% NumNodes - (read-only) Number of Nodes this bus.
18+
% SectionID - (read-only) Integer ID of the feeder section in which this bus is located.
19+
% SeqVoltages - (read-only) Double Array of sequence voltages at this bus.
20+
% TotalMiles - (read-only) Total length of line downline from this bus, in miles. For recloser siting algorithm.
21+
% VLL - (read-only) For 2- and 3-phase buses, returns array of complex numbers represetin L-L voltages in volts. Returns -1.0 for 1-phase bus. If more than 3 phases, returns only first 3.
22+
% VMagAngle - (read-only) Variant Array of doubles containing voltages in Magnitude (VLN), angle (deg)
23+
% Voc - (read-only) Open circuit voltage; Complex array.
24+
% Voltages - (read-only) Complex array of voltages at this bus.
25+
% YscMatrix - (read-only) Complex array of Ysc matrix at bus. Column by column.
26+
% Zsc0 - (read-only) Complex Zero-Sequence short circuit impedance at bus.
27+
% Zsc1 - (read-only) Complex Positive-Sequence short circuit impedance at bus..
28+
% ZscMatrix - (read-only) Complex array of Zsc matrix at bus. Column by column.
29+
% kVBase - (read-only) Base voltage at bus in kV
30+
% puVLL - (read-only) Returns Complex array of pu L-L voltages for 2- and 3-phase buses. Returns -1.0 for 1-phase bus. If more than 3 phases, returns only 3 phases.
31+
% puVmagAngle - (read-only) Array of doubles containig voltage magnitude, angle pairs in per unit
32+
% puVoltages - (read-only) Complex Array of pu voltages at the bus.
33+
% x - X Coordinate for bus (double)
34+
% y - Y coordinate for bus(double)
35+
%
36+
% Methods:
37+
% GetUniqueNodeNumber -
38+
% ZscRefresh -
39+
40+
properties
41+
Coorddefined
42+
CplxSeqVoltages
43+
Cust_Duration
44+
Cust_Interrupts
45+
Distance
46+
Int_Duration
47+
Isc
48+
Lambda
49+
N_Customers
50+
N_interrupts
51+
Name
52+
Nodes
53+
NumNodes
54+
SectionID
55+
SeqVoltages
56+
TotalMiles
57+
VLL
58+
VMagAngle
59+
Voc
60+
Voltages
61+
YscMatrix
62+
Zsc0
63+
Zsc1
64+
ZscMatrix
65+
kVBase
66+
puVLL
67+
puVmagAngle
68+
puVoltages
69+
x
70+
y
71+
end
72+
73+
methods
74+
75+
function result = GetUniqueNodeNumber(obj, StartNumber)
76+
result = calllib('dss_capi_v7', 'Bus_GetUniqueNodeNumber', StartNumber);
77+
end
78+
79+
function result = ZscRefresh(obj)
80+
result = (calllib('dss_capi_v7', 'Bus_ZscRefresh') ~= 0);
81+
end
82+
83+
function result = get.Coorddefined(obj)
84+
% (read-only) False=0 else True. Indicates whether a coordinate has been defined for this bus
85+
result = (calllib('dss_capi_v7', 'Bus_Get_Coorddefined') ~= 0);
86+
end
87+
88+
function result = get.CplxSeqVoltages(obj)
89+
% (read-only) Complex Double array of Sequence Voltages (0, 1, 2) at this Bus.
90+
result = DSS_MATLAB.get_float64_array('Bus_Get_CplxSeqVoltages');
91+
end
92+
93+
function result = get.Cust_Duration(obj)
94+
% (read-only) Accumulated customer outage durations
95+
result = calllib('dss_capi_v7', 'Bus_Get_Cust_Duration');
96+
end
97+
98+
function result = get.Cust_Interrupts(obj)
99+
% (read-only) Annual number of customer-interruptions from this bus
100+
result = calllib('dss_capi_v7', 'Bus_Get_Cust_Interrupts');
101+
end
102+
103+
function result = get.Distance(obj)
104+
% (read-only) Distance from energymeter (if non-zero)
105+
result = calllib('dss_capi_v7', 'Bus_Get_Distance');
106+
end
107+
108+
function result = get.Int_Duration(obj)
109+
% (read-only) Average interruption duration, hr.
110+
result = calllib('dss_capi_v7', 'Bus_Get_Int_Duration');
111+
end
112+
113+
function result = get.Isc(obj)
114+
% (read-only) Short circuit currents at bus; Complex Array.
115+
result = DSS_MATLAB.get_float64_array('Bus_Get_Isc');
116+
end
117+
118+
function result = get.Lambda(obj)
119+
% (read-only) Accumulated failure rate downstream from this bus; faults per year
120+
result = calllib('dss_capi_v7', 'Bus_Get_Lambda');
121+
end
122+
123+
function result = get.N_Customers(obj)
124+
% (read-only) Total numbers of customers served downline from this bus
125+
result = calllib('dss_capi_v7', 'Bus_Get_N_Customers');
126+
end
127+
128+
function result = get.N_interrupts(obj)
129+
% (read-only) Number of interruptions this bus per year
130+
result = calllib('dss_capi_v7', 'Bus_Get_N_interrupts');
131+
end
132+
133+
function result = get.Name(obj)
134+
% (read-only) Name of Bus
135+
result = calllib('dss_capi_v7', 'Bus_Get_Name');
136+
end
137+
138+
function result = get.Nodes(obj)
139+
% (read-only) Integer Array of Node Numbers defined at the bus in same order as the voltages.
140+
result = DSS_MATLAB.get_int32_array('Bus_Get_Nodes');
141+
end
142+
143+
function result = get.NumNodes(obj)
144+
% (read-only) Number of Nodes this bus.
145+
result = calllib('dss_capi_v7', 'Bus_Get_NumNodes');
146+
end
147+
148+
function result = get.SectionID(obj)
149+
% (read-only) Integer ID of the feeder section in which this bus is located.
150+
result = calllib('dss_capi_v7', 'Bus_Get_SectionID');
151+
end
152+
153+
function result = get.SeqVoltages(obj)
154+
% (read-only) Double Array of sequence voltages at this bus.
155+
result = DSS_MATLAB.get_float64_array('Bus_Get_SeqVoltages');
156+
end
157+
158+
function result = get.TotalMiles(obj)
159+
% (read-only) Total length of line downline from this bus, in miles. For recloser siting algorithm.
160+
result = calllib('dss_capi_v7', 'Bus_Get_TotalMiles');
161+
end
162+
163+
function result = get.VLL(obj)
164+
% (read-only) For 2- and 3-phase buses, returns array of complex numbers represetin L-L voltages in volts. Returns -1.0 for 1-phase bus. If more than 3 phases, returns only first 3.
165+
result = DSS_MATLAB.get_float64_array('Bus_Get_VLL');
166+
end
167+
168+
function result = get.VMagAngle(obj)
169+
% (read-only) Variant Array of doubles containing voltages in Magnitude (VLN), angle (deg)
170+
result = DSS_MATLAB.get_float64_array('Bus_Get_VMagAngle');
171+
end
172+
173+
function result = get.Voc(obj)
174+
% (read-only) Open circuit voltage; Complex array.
175+
result = DSS_MATLAB.get_float64_array('Bus_Get_Voc');
176+
end
177+
178+
function result = get.Voltages(obj)
179+
% (read-only) Complex array of voltages at this bus.
180+
result = DSS_MATLAB.get_float64_array('Bus_Get_Voltages');
181+
end
182+
183+
function result = get.YscMatrix(obj)
184+
% (read-only) Complex array of Ysc matrix at bus. Column by column.
185+
result = DSS_MATLAB.get_float64_array('Bus_Get_YscMatrix');
186+
end
187+
188+
function result = get.Zsc0(obj)
189+
% (read-only) Complex Zero-Sequence short circuit impedance at bus.
190+
result = DSS_MATLAB.get_float64_array('Bus_Get_Zsc0');
191+
end
192+
193+
function result = get.Zsc1(obj)
194+
% (read-only) Complex Positive-Sequence short circuit impedance at bus..
195+
result = DSS_MATLAB.get_float64_array('Bus_Get_Zsc1');
196+
end
197+
198+
function result = get.ZscMatrix(obj)
199+
% (read-only) Complex array of Zsc matrix at bus. Column by column.
200+
result = DSS_MATLAB.get_float64_array('Bus_Get_ZscMatrix');
201+
end
202+
203+
function result = get.kVBase(obj)
204+
% (read-only) Base voltage at bus in kV
205+
result = calllib('dss_capi_v7', 'Bus_Get_kVBase');
206+
end
207+
208+
function result = get.puVLL(obj)
209+
% (read-only) Returns Complex array of pu L-L voltages for 2- and 3-phase buses. Returns -1.0 for 1-phase bus. If more than 3 phases, returns only 3 phases.
210+
result = DSS_MATLAB.get_float64_array('Bus_Get_puVLL');
211+
end
212+
213+
function result = get.puVmagAngle(obj)
214+
% (read-only) Array of doubles containig voltage magnitude, angle pairs in per unit
215+
result = DSS_MATLAB.get_float64_array('Bus_Get_puVmagAngle');
216+
end
217+
218+
function result = get.puVoltages(obj)
219+
% (read-only) Complex Array of pu voltages at the bus.
220+
result = DSS_MATLAB.get_float64_array('Bus_Get_puVoltages');
221+
end
222+
223+
function result = get.x(obj)
224+
% X Coordinate for bus (double)
225+
result = calllib('dss_capi_v7', 'Bus_Get_x');
226+
end
227+
function obj = set.x(obj, Value)
228+
calllib('dss_capi_v7', 'Bus_Set_x', Value);
229+
obj.CheckForError();
230+
end
231+
232+
function result = get.y(obj)
233+
% Y coordinate for bus(double)
234+
result = calllib('dss_capi_v7', 'Bus_Get_y');
235+
end
236+
function obj = set.y(obj, Value)
237+
calllib('dss_capi_v7', 'Bus_Set_y', Value);
238+
obj.CheckForError();
239+
end
240+
end
241+
end

0 commit comments

Comments
 (0)