Skip to content

Commit

Permalink
ctx: Fix/migrate get_string_array, monitors, ZIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
PMeira committed Aug 29, 2022
1 parent 923c47b commit 9904fee
Show file tree
Hide file tree
Showing 39 changed files with 102 additions and 92 deletions.
54 changes: 27 additions & 27 deletions +DSS_MATLAB/APIUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,42 +122,42 @@ function delete(obj)
function result = get_string_array(obj, funcname, varargin)
dataPointer = libpointer('voidPtr', 0);
countPointer = libpointer('int32Ptr', [0, 0]);
calllib(obj.libname, funcname, dataPointer, countPointer, varargin{:});
calllib(obj.libname, funcname, obj.dssctx, dataPointer, countPointer, varargin{:});
result = cell(countPointer.Value(1), 1);
for i=1:countPointer.Value(1)
result(i) = cellstr(calllib(obj.libname, 'DSS_Get_PAnsiChar', dataPointer, i - 1));
end
calllib(obj.libname, 'DSS_Dispose_PPAnsiChar', dataPointer, countPointer.Value(2));
end

function result = get_int8_array(obj, funcname, varargin)
dataPointer = libpointer('int8PtrPtr');
countPointer = libpointer('int32Ptr', [0, 0]);
calllib(obj.libname, funcname, dataPointer, countPointer, varargin{:});
dataPointer.Value
setdatatype(dataPointer.Value, 'int8Ptr', 1, countPointer.Value(1));
result = dataPointer.Value;
calllib(obj.libname, 'DSS_Dispose_PByte', dataPointer);
obj.CheckForError();
end
% function result = get_int8_array(obj, funcname, varargin)
% dataPointer = libpointer('int8PtrPtr');
% countPointer = libpointer('int32Ptr', [0, 0]);
% calllib(obj.libname, funcname, dataPointer, countPointer, varargin{:});
% dataPointer.Value
% setdatatype(dataPointer.Value, 'int8Ptr', 1, countPointer.Value(1));
% result = dataPointer.Value;
% calllib(obj.libname, 'DSS_Dispose_PByte', dataPointer);
% obj.CheckForError();
% end

function result = get_int32_array(obj, funcname, varargin)
dataPointer = libpointer('int32PtrPtr');
countPointer = libpointer('int32Ptr', [0, 0]);
calllib(obj.libname, funcname, dataPointer, countPointer, varargin{:});
setdatatype(dataPointer.Value, 'int32Ptr', 1, countPointer.Value(1));
result = dataPointer.Value;
calllib(obj.libname, 'DSS_Dispose_PInteger', dataPointer);
end
% function result = get_int32_array(obj, funcname, varargin)
% dataPointer = libpointer('int32PtrPtr');
% countPointer = libpointer('int32Ptr', [0, 0]);
% calllib(obj.libname, funcname, dataPointer, countPointer, varargin{:});
% setdatatype(dataPointer.Value, 'int32Ptr', 1, countPointer.Value(1));
% result = dataPointer.Value;
% calllib(obj.libname, 'DSS_Dispose_PInteger', dataPointer);
% end

function result = get_float64_array(obj, funcname, varargin)
dataPointer = libpointer('doublePtrPtr');
countPointer = libpointer('int32Ptr', [0, 0]);
calllib(obj.libname, funcname, dataPointer, countPointer, varargin{:});
setdatatype(dataPointer.Value, 'doublePtr', 1, countPointer.Value(1));
result = dataPointer.Value;
calllib(obj.libname, 'DSS_Dispose_PDouble', dataPointer);
end
% function result = get_float64_array(obj, funcname, varargin)
% dataPointer = libpointer('doublePtrPtr');
% countPointer = libpointer('int32Ptr', [0, 0]);
% calllib(obj.libname, funcname, dataPointer, countPointer, varargin{:});
% setdatatype(dataPointer.Value, 'doublePtr', 1, countPointer.Value(1));
% result = dataPointer.Value;
% calllib(obj.libname, 'DSS_Dispose_PDouble', dataPointer);
% end

end
end
2 changes: 1 addition & 1 deletion +DSS_MATLAB/IActiveClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

function result = get.AllNames(obj)
% (read-only) Array of strings consisting of all element names in the active class.
result = obj.apiutil.get_string_array('ctx_ActiveClass_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_ActiveClass_Get_AllNames');
obj.CheckForError();
end

Expand Down
8 changes: 4 additions & 4 deletions +DSS_MATLAB/IBus.m
Original file line number Diff line number Diff line change
Expand Up @@ -301,19 +301,19 @@

function result = get.LoadList(obj)
% List of strings: Full Names of LOAD elements connected to the active bus.
result = obj.apiutil.get_string_array('ctx_Bus_Get_LoadList', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Bus_Get_LoadList');
obj.CheckForError();
end

function result = get.LineList(obj)
% List of strings: Full Names of LINE elements connected to the active bus.
result = obj.apiutil.get_string_array('ctx_Bus_Get_LineList', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Bus_Get_LineList');
obj.CheckForError();
end

function result = get.AllPCEatBus(obj)
% Returns an array with the names of all PCE connected to the active bus
result = obj.apiutil.get_string_array('ctx_Bus_Get_AllPCEatBus', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Bus_Get_AllPCEatBus');
obj.CheckForError();
if (~isempty(result))
result{end + 1} = '';
Expand All @@ -324,7 +324,7 @@

function result = get.AllPDEatBus(obj)
% Returns an array with the names of all PDE connected to the active bus
result = obj.apiutil.get_string_array('ctx_Bus_Get_AllPDEatBus', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Bus_Get_AllPDEatBus');
obj.CheckForError();
if (~isempty(result))
result{end + 1} = '';
Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/ICNData.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

function result = get.AllNames(obj)
% Array of strings with all CNData names
result = obj.apiutil.get_string_array('ctx_CNData_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_CNData_Get_AllNames');
end

function result = get.Count(obj)
Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/ICapControls.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

function result = get.AllNames(obj)
% Array of strings with all CapControl names
result = obj.apiutil.get_string_array('ctx_CapControls_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_CapControls_Get_AllNames');
end

function result = get.Count(obj)
Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/ICapacitors.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

function result = get.AllNames(obj)
% Array of strings with all Capacitor names
result = obj.apiutil.get_string_array('ctx_Capacitors_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Capacitors_Get_AllNames');
end

function result = get.Count(obj)
Expand Down
8 changes: 4 additions & 4 deletions +DSS_MATLAB/ICircuit.m
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@

function result = get.AllBusNames(obj)
% (read-only) Array of strings containing names of all buses in circuit (see AllNodeNames).
result = obj.apiutil.get_string_array('ctx_Circuit_Get_AllBusNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Circuit_Get_AllBusNames');
obj.CheckForError();
end

Expand Down Expand Up @@ -384,7 +384,7 @@

function result = get.AllElementNames(obj)
% (read-only) Array of strings containing Full Name of all elements.
result = obj.apiutil.get_string_array('ctx_Circuit_Get_AllElementNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Circuit_Get_AllElementNames');
obj.CheckForError();
end

Expand All @@ -397,7 +397,7 @@

function result = get.AllNodeNames(obj)
% (read-only) Array of strings containing full name of each node in system in same order as returned by AllBusVolts, etc.
result = obj.apiutil.get_string_array('ctx_Circuit_Get_AllNodeNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Circuit_Get_AllNodeNames');
obj.CheckForError();
end

Expand Down Expand Up @@ -477,7 +477,7 @@

function result = get.YNodeOrder(obj)
% (read-only) Array of strings containing the names of the nodes in the same order as the Y matrix
result = obj.apiutil.get_string_array('ctx_Circuit_Get_YNodeOrder', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Circuit_Get_YNodeOrder');
obj.CheckForError();
end

Expand Down
6 changes: 3 additions & 3 deletions +DSS_MATLAB/ICktElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@

function result = get.AllPropertyNames(obj)
% (read-only) Array containing all property names of the active device.
result = obj.apiutil.get_string_array('ctx_CktElement_Get_AllPropertyNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_CktElement_Get_AllPropertyNames');
obj.CheckForError();
end

function result = get.AllVariableNames(obj)
% (read-only) Array of strings listing all the published variable names, if a PCElement. Otherwise, null string.
result = obj.apiutil.get_string_array('ctx_CktElement_Get_AllVariableNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_CktElement_Get_AllVariableNames');
obj.CheckForError();
end

Expand All @@ -194,7 +194,7 @@

function result = get.BusNames(obj)
% Array of strings. Get Bus definitions to which each terminal is connected. 0-based array.
result = obj.apiutil.get_string_array('ctx_CktElement_Get_BusNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_CktElement_Get_BusNames');
obj.CheckForError();
end
function obj = set.BusNames(obj, Value)
Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/ICtrlQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

function result = get.Queue(obj)
% (read-only) Array of strings containing the entire queue in CSV format
result = obj.apiutil.get_string_array('ctx_CtrlQueue_Get_Queue', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_CtrlQueue_Get_Queue');
obj.CheckForError();
end

Expand Down
4 changes: 2 additions & 2 deletions +DSS_MATLAB/IDSS.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

function result = get.Classes(obj)
% (read-only) List of DSS intrinsic classes (names of the classes)
result = obj.apiutil.get_string_array('ctx_DSS_Get_Classes', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_DSS_Get_Classes');
obj.CheckForError();
end

Expand Down Expand Up @@ -166,7 +166,7 @@

function result = get.UserClasses(obj)
% (read-only) List of user-defined classes
result = obj.apiutil.get_string_array('ctx_DSS_Get_UserClasses', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_DSS_Get_UserClasses');
obj.CheckForError();
end

Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/IDSSElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

function result = get.AllPropertyNames(obj)
% (read-only) Array of strings containing the names of all properties for the active DSS object.
result = obj.apiutil.get_string_array('ctx_DSSElement_Get_AllPropertyNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_DSSElement_Get_AllPropertyNames');
obj.CheckForError();
end

Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/IFuses.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

function result = get.AllNames(obj)
% Array of strings with all Fuse names
result = obj.apiutil.get_string_array('ctx_Fuses_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Fuses_Get_AllNames');
end

function result = get.Count(obj)
Expand Down
4 changes: 2 additions & 2 deletions +DSS_MATLAB/IGenerators.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

function result = get.AllNames(obj)
% Array of strings with all Generator names
result = obj.apiutil.get_string_array('ctx_Generators_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Generators_Get_AllNames');
end

function result = get.Count(obj)
Expand Down Expand Up @@ -147,7 +147,7 @@

function result = get.RegisterNames(obj)
% (read-only) Array of Names of all generator energy meter registers
result = obj.apiutil.get_string_array('ctx_Generators_Get_RegisterNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Generators_Get_RegisterNames');
obj.CheckForError();
end

Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/IISources.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

function result = get.AllNames(obj)
% Array of strings with all ISource names
result = obj.apiutil.get_string_array('ctx_ISources_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_ISources_Get_AllNames');
end

function result = get.Count(obj)
Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/ILineCodes.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

function result = get.AllNames(obj)
% Array of strings with all LineCode names
result = obj.apiutil.get_string_array('ctx_LineCodes_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_LineCodes_Get_AllNames');
end

function result = get.Count(obj)
Expand Down
4 changes: 2 additions & 2 deletions +DSS_MATLAB/ILineGeometries.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

function result = get.AllNames(obj)
% Array of strings with all LineGeometrie names
result = obj.apiutil.get_string_array('ctx_LineGeometries_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_LineGeometries_Get_AllNames');
end

function result = get.Count(obj)
Expand Down Expand Up @@ -119,7 +119,7 @@

function result = get.Conductors(obj)
% (read-only) Array of strings with names of all conductors in the active LineGeometry object
result = obj.apiutil.get_string_array('ctx_LineGeometries_Get_Conductors', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_LineGeometries_Get_Conductors');
obj.CheckForError();
end

Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/ILineSpacings.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

function result = get.AllNames(obj)
% Array of strings with all LineSpacing names
result = obj.apiutil.get_string_array('ctx_LineSpacings_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_LineSpacings_Get_AllNames');
end

function result = get.Count(obj)
Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/ILines.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

function result = get.AllNames(obj)
% Array of strings with all Line names
result = obj.apiutil.get_string_array('ctx_Lines_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Lines_Get_AllNames');
end

function result = get.Count(obj)
Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/ILoadShapes.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

function result = get.AllNames(obj)
% Array of strings with all LoadShape names
result = obj.apiutil.get_string_array('ctx_LoadShapes_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_LoadShapes_Get_AllNames');
end

function result = get.Count(obj)
Expand Down
2 changes: 1 addition & 1 deletion +DSS_MATLAB/ILoads.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

function result = get.AllNames(obj)
% Array of strings with all Load names
result = obj.apiutil.get_string_array('ctx_Loads_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Loads_Get_AllNames');
end

function result = get.Count(obj)
Expand Down
10 changes: 5 additions & 5 deletions +DSS_MATLAB/IMeters.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@

function result = get.AllNames(obj)
% Array of strings with all Meter names
result = obj.apiutil.get_string_array('ctx_Meters_Get_AllNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Meters_Get_AllNames');
end

function result = get.Count(obj)
Expand Down Expand Up @@ -189,13 +189,13 @@

function result = get.AllBranchesInZone(obj)
% (read-only) Wide string list of all branches in zone of the active energymeter object.
result = obj.apiutil.get_string_array('ctx_Meters_Get_AllBranchesInZone', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Meters_Get_AllBranchesInZone');
obj.CheckForError();
end

function result = get.AllEndElements(obj)
% (read-only) Array of names of all zone end elements.
result = obj.apiutil.get_string_array('ctx_Meters_Get_AllEndElements', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Meters_Get_AllEndElements');
obj.CheckForError();
end

Expand Down Expand Up @@ -314,7 +314,7 @@

function result = get.RegisterNames(obj)
% (read-only) Array of strings containing the names of the registers.
result = obj.apiutil.get_string_array('ctx_Meters_Get_RegisterNames', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Meters_Get_RegisterNames');
obj.CheckForError();
end

Expand Down Expand Up @@ -392,7 +392,7 @@

function result = get.ZonePCE(obj)
% Returns the list of all PCE within the area covered by the energy meter
result = obj.apiutil.get_string_array('ctx_Meters_Get_ZonePCE', obj.dssctx);
result = obj.apiutil.get_string_array('ctx_Meters_Get_ZonePCE');
obj.CheckForError();
if (~result)
result = {};
Expand Down
Loading

0 comments on commit 9904fee

Please sign in to comment.