Skip to content

Commit 5f13eae

Browse files
committed
Major upgrade with several fixes and new features
- Update thunk and fix other code translation issues - Complement `get_*_array` functions to pass parameters - Properly implement ActiveCircuit.Buses, ActiveCircuit.CktElements, ActiveCktElement.Properties - CtrlQueue: Add missing `Push` method - Several changes to match DSS Python (more_idx branch, lots of new idx properties) - Expose public methods to allow using the `methods` function - Update iterable classes to match current DSS Python - Add new methods from DSS C-API (Transformers.LossesByType, Transformers.AllLossesByType, DSS.AllowEditor) - Tentative fix for `CktElement.Variablei` - Tweak doc strings - More error checking
1 parent b639f01 commit 5f13eae

Some content is hidden

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

53 files changed

+1831
-942
lines changed

+DSS_MATLAB/Base.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@
1414
end
1515
end
1616
end
17+
18+
methods (Access = public)
19+
20+
end
21+
1722
methods
23+
1824
function obj = CheckForError(obj)
1925
error = calllib('dss_capi_v7', 'Error_Get_Number');
2026
if error ~= 0

+DSS_MATLAB/IActiveClass.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
NumElements
2121
end
2222

23+
methods (Access = public)
24+
25+
end
2326
methods
2427

2528
function result = get.ActiveClassName(obj)

+DSS_MATLAB/IBus.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
% SeqVoltages - (read-only) Double Array of sequence voltages at this bus.
2020
% TotalMiles - (read-only) Total length of line downline from this bus, in miles. For recloser siting algorithm.
2121
% 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)
22+
% VMagAngle - (read-only) Variant Array of doubles containing voltages in Magnitude (VLN), angle (deg)
2323
% Voc - (read-only) Open circuit voltage; Complex array.
2424
% Voltages - (read-only) Complex array of voltages at this bus.
2525
% YscMatrix - (read-only) Complex array of Ysc matrix at bus. Column by column.
@@ -70,7 +70,7 @@
7070
y
7171
end
7272

73-
methods
73+
methods (Access = public)
7474

7575
function result = GetUniqueNodeNumber(obj, StartNumber)
7676
result = calllib('dss_capi_v7', 'Bus_GetUniqueNodeNumber', StartNumber);
@@ -80,6 +80,9 @@
8080
result = (calllib('dss_capi_v7', 'Bus_ZscRefresh') ~= 0);
8181
end
8282

83+
end
84+
methods
85+
8386
function result = get.Coorddefined(obj)
8487
% (read-only) False=0 else True. Indicates whether a coordinate has been defined for this bus
8588
result = (calllib('dss_capi_v7', 'Bus_Get_Coorddefined') ~= 0);

+DSS_MATLAB/ICNData.m

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
% ICNData: DSS MATLAB interface class to DSS C-API
33
%
44
% Properties:
5-
% AllNames - (read-only) Array of strings with names of all devices
5+
% AllNames - Array of strings with all CNData names
6+
% Count - Number of CNData objects
7+
% First - Set first object of CNData; returns 0 if none.
8+
% Name - Get/sets the name of the current active CNData
9+
% Next - Sets next CNData active; returns 0 if no more.
10+
% idx - Sets next CNData active; returns 0 if no more.
611
% Conductors - (read-only) Array of strings with names of all conductors in the active CNData object
7-
% Count - (read-only) Number of CNData
8-
% First -
9-
% Next -
10-
% Name - Name of active CNData
1112
% EmergAmps - Emergency ampere rating
1213
% NormAmps - Normal Ampere rating
1314
% Rdc -
@@ -29,11 +30,12 @@
2930

3031
properties
3132
AllNames
32-
Conductors
3333
Count
3434
First
35-
Next
3635
Name
36+
Next
37+
idx
38+
Conductors
3739
EmergAmps
3840
NormAmps
3941
Rdc
@@ -54,40 +56,55 @@
5456
RStrand
5557
end
5658

59+
methods (Access = public)
60+
61+
end
5762
methods
5863

5964
function result = get.AllNames(obj)
60-
% (read-only) Array of strings with names of all devices
65+
% Array of strings with all CNData names
6166
result = DSS_MATLAB.get_string_array('CNData_Get_AllNames');
6267
end
6368

64-
function result = get.Conductors(obj)
65-
% (read-only) Array of strings with names of all conductors in the active CNData object
66-
result = DSS_MATLAB.get_string_array('CNData_Get_Conductors');
67-
end
68-
6969
function result = get.Count(obj)
70-
% (read-only) Number of CNData
70+
% Number of CNData objects
7171
result = calllib('dss_capi_v7', 'CNData_Get_Count');
7272
end
7373

7474
function result = get.First(obj)
75+
% Set first object of CNData; returns 0 if none.
7576
result = calllib('dss_capi_v7', 'CNData_Get_First');
7677
end
7778

78-
function result = get.Next(obj)
79-
result = calllib('dss_capi_v7', 'CNData_Get_Next');
80-
end
81-
8279
function result = get.Name(obj)
83-
% Name of active CNData
80+
% Get/sets the name of the current active CNData
8481
result = calllib('dss_capi_v7', 'CNData_Get_Name');
8582
end
8683
function obj = set.Name(obj, Value)
8784
calllib('dss_capi_v7', 'CNData_Set_Name', Value);
8885
obj.CheckForError();
8986
end
9087

88+
function result = get.Next(obj)
89+
% Sets next CNData active; returns 0 if no more.
90+
result = calllib('dss_capi_v7', 'CNData_Get_Next');
91+
end
92+
93+
function result = get.idx(obj)
94+
% Get/set active CNData by index; 1..Count
95+
result = calllib('dss_capi_v7', 'CNData_Get_idx');
96+
end
97+
function obj = set.idx(obj, Value)
98+
calllib('dss_capi_v7', 'CNData_Set_idx', Value);
99+
obj.CheckForError();
100+
end
101+
102+
103+
function result = get.Conductors(obj)
104+
% (read-only) Array of strings with names of all conductors in the active CNData object
105+
result = DSS_MATLAB.get_string_array('CNData_Get_Conductors');
106+
end
107+
91108
function result = get.EmergAmps(obj)
92109
% Emergency ampere rating
93110
result = calllib('dss_capi_v7', 'CNData_Get_EmergAmps');

+DSS_MATLAB/ICapControls.m

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
% ICapControls: DSS MATLAB interface class to DSS C-API
33
%
44
% Properties:
5-
% AllNames - (read-only) Array of strings with all CapControl names.
5+
% AllNames - Array of strings with all CapControl names
6+
% Count - Number of CapControl objects
7+
% First - Set first object of CapControl; returns 0 if none.
8+
% Name - Get/sets the name of the current active CapControl
9+
% Next - Sets next CapControl active; returns 0 if no more.
10+
% idx - Sets next CapControl active; returns 0 if no more.
611
% CTratio - Transducer ratio from pirmary current to control current.
712
% Capacitor - Name of the Capacitor that is controlled.
8-
% Count - (read-only) Number of CapControls in Active Circuit
913
% DeadTime -
1014
% Delay - Time delay [s] to switch on after arming. Control may reset before actually switching.
1115
% DelayOff - Time delay [s] before swithcing off a step. Control may reset before actually switching.
12-
% First - (read-only) Sets the first CapControl as active. Return 0 if none.
1316
% Mode - Type of automatic controller.
1417
% MonitoredObj - Full name of the element that PT and CT are connected to.
1518
% MonitoredTerm - Terminal number on the element that PT and CT are connected to.
16-
% Name - Sets a CapControl active by name.
17-
% Next - (read-only) Gets the next CapControl in the circut. Returns 0 if none.
1819
% OFFSetting - Threshold to switch off a step. See Mode for units.
1920
% ONSetting - Threshold to arm or switch on a step. See Mode for units.
2021
% PTratio - Transducer ratio from primary feeder to control voltage.
@@ -27,18 +28,19 @@
2728

2829
properties
2930
AllNames
31+
Count
32+
First
33+
Name
34+
Next
35+
idx
3036
CTratio
3137
Capacitor
32-
Count
3338
DeadTime
3439
Delay
3540
DelayOff
36-
First
3741
Mode
3842
MonitoredObj
3943
MonitoredTerm
40-
Name
41-
Next
4244
OFFSetting
4345
ONSetting
4446
PTratio
@@ -47,17 +49,54 @@
4749
Vmin
4850
end
4951

50-
methods
52+
methods (Access = public)
5153

5254
function obj = Reset(obj)
5355
calllib('dss_capi_v7', 'CapControls_Reset');
5456
end
5557

58+
end
59+
methods
60+
5661
function result = get.AllNames(obj)
57-
% (read-only) Array of strings with all CapControl names.
62+
% Array of strings with all CapControl names
5863
result = DSS_MATLAB.get_string_array('CapControls_Get_AllNames');
5964
end
6065

66+
function result = get.Count(obj)
67+
% Number of CapControl objects
68+
result = calllib('dss_capi_v7', 'CapControls_Get_Count');
69+
end
70+
71+
function result = get.First(obj)
72+
% Set first object of CapControl; returns 0 if none.
73+
result = calllib('dss_capi_v7', 'CapControls_Get_First');
74+
end
75+
76+
function result = get.Name(obj)
77+
% Get/sets the name of the current active CapControl
78+
result = calllib('dss_capi_v7', 'CapControls_Get_Name');
79+
end
80+
function obj = set.Name(obj, Value)
81+
calllib('dss_capi_v7', 'CapControls_Set_Name', Value);
82+
obj.CheckForError();
83+
end
84+
85+
function result = get.Next(obj)
86+
% Sets next CapControl active; returns 0 if no more.
87+
result = calllib('dss_capi_v7', 'CapControls_Get_Next');
88+
end
89+
90+
function result = get.idx(obj)
91+
% Get/set active CapControl by index; 1..Count
92+
result = calllib('dss_capi_v7', 'CapControls_Get_idx');
93+
end
94+
function obj = set.idx(obj, Value)
95+
calllib('dss_capi_v7', 'CapControls_Set_idx', Value);
96+
obj.CheckForError();
97+
end
98+
99+
61100
function result = get.CTratio(obj)
62101
% Transducer ratio from pirmary current to control current.
63102
result = calllib('dss_capi_v7', 'CapControls_Get_CTratio');
@@ -76,11 +115,6 @@
76115
obj.CheckForError();
77116
end
78117

79-
function result = get.Count(obj)
80-
% (read-only) Number of CapControls in Active Circuit
81-
result = calllib('dss_capi_v7', 'CapControls_Get_Count');
82-
end
83-
84118
function result = get.DeadTime(obj)
85119
result = calllib('dss_capi_v7', 'CapControls_Get_DeadTime');
86120
end
@@ -107,11 +141,6 @@
107141
obj.CheckForError();
108142
end
109143

110-
function result = get.First(obj)
111-
% (read-only) Sets the first CapControl as active. Return 0 if none.
112-
result = calllib('dss_capi_v7', 'CapControls_Get_First');
113-
end
114-
115144
function result = get.Mode(obj)
116145
% Type of automatic controller.
117146
result = calllib('dss_capi_v7', 'CapControls_Get_Mode');
@@ -139,20 +168,6 @@
139168
obj.CheckForError();
140169
end
141170

142-
function result = get.Name(obj)
143-
% Sets a CapControl active by name.
144-
result = calllib('dss_capi_v7', 'CapControls_Get_Name');
145-
end
146-
function obj = set.Name(obj, Value)
147-
calllib('dss_capi_v7', 'CapControls_Set_Name', Value);
148-
obj.CheckForError();
149-
end
150-
151-
function result = get.Next(obj)
152-
% (read-only) Gets the next CapControl in the circut. Returns 0 if none.
153-
result = calllib('dss_capi_v7', 'CapControls_Get_Next');
154-
end
155-
156171
function result = get.OFFSetting(obj)
157172
% Threshold to switch off a step. See Mode for units.
158173
result = calllib('dss_capi_v7', 'CapControls_Get_OFFSetting');

0 commit comments

Comments
 (0)