├── +DSS_MATLAB ├── APIUtil.m ├── Base.m ├── ControlModes.m ├── DSSCompatFlags.m ├── GeneratorStatus.m ├── IActiveClass.m ├── IBus.m ├── ICNData.m ├── ICapControls.m ├── ICapacitors.m ├── ICircuit.m ├── ICktElement.m ├── ICtrlQueue.m ├── IDSS.m ├── IDSSElement.m ├── IDSSEvents.m ├── IDSSProgress.m ├── IDSSProperty.m ├── IDSS_Executive.m ├── IDSSimComs.m ├── IError.m ├── IFuses.m ├── IGICSources.m ├── IGenerators.m ├── IISources.m ├── ILineCodes.m ├── ILineGeometries.m ├── ILineSpacings.m ├── ILines.m ├── ILoadShapes.m ├── ILoads.m ├── IMeters.m ├── IMonitors.m ├── IPDElements.m ├── IPVSystems.m ├── IParallel.m ├── IParser.m ├── IReactors.m ├── IReclosers.m ├── IReduceCkt.m ├── IRegControls.m ├── IRelays.m ├── ISensors.m ├── ISettings.m ├── ISolution.m ├── IStorages.m ├── ISwtControls.m ├── ITSData.m ├── IText.m ├── ITopology.m ├── ITransformers.m ├── IVsources.m ├── IWireData.m ├── IXYCurves.m ├── IYMatrix.m ├── IZIP.m ├── LineUnits.m ├── LoadStatus.m ├── OCPDevTypes.m ├── SolutionAlgorithms.m ├── SolveModes.m ├── build_thunk.m.disabled ├── ctxrefcount.m ├── dss_capi_no_thunk.m ├── librefcount.m └── version.m ├── .github └── workflows │ └── builds.yml ├── .gitignore ├── LICENSE ├── README.md └── examples ├── 13Bus.zip └── 13Bus ├── IEEE13Node_BusXY.csv ├── IEEE13Nodeckt.dss ├── IEEELineCodes.dss └── run.m /+DSS_MATLAB/Base.m: -------------------------------------------------------------------------------- 1 | classdef Base < handle & matlab.mixin.CustomDisplay & matlab.mixin.SetGet 2 | properties (Access = protected, Hidden = true) 3 | apiutil 4 | libname 5 | dssctx 6 | end 7 | 8 | methods (Access = protected) 9 | function propgrp = getPropertyGroups(obj) 10 | propgrp = matlab.mixin.util.PropertyGroup(); 11 | end 12 | 13 | function header = getHeader(obj) 14 | if ~isscalar(obj) 15 | header = getHeader@matlab.mixin.CustomDisplay(obj); 16 | else 17 | headerStr = matlab.mixin.CustomDisplay.getClassNameForHeader(obj); 18 | headerStr = [headerStr,' (DSS MATLAB interface class)']; 19 | header = sprintf('%s\n',headerStr); 20 | end 21 | end 22 | end 23 | 24 | methods (Access = public) 25 | function obj = Base(apiutil) 26 | obj.apiutil = apiutil; 27 | obj.libname = apiutil.libname; 28 | obj.dssctx = apiutil.dssctx; 29 | end 30 | 31 | end 32 | 33 | methods 34 | 35 | function varargout = CheckForError(obj, varargin) 36 | error = calllib(obj.libname, 'ctx_Error_Get_Number', obj.dssctx); 37 | if error ~= 0 38 | ME = MException(['DSS_MATLAB:Error' int2str(error)], strrep(calllib(obj.libname, 'ctx_Error_Get_Description', obj.dssctx), '\', '\\')); 39 | throw(ME); 40 | end 41 | varargout = varargin; 42 | end 43 | 44 | function obj = clear_api_buffers(obj) 45 | calllib(obj.libname, 'ctx_DSS_DisposeGRData', obj.dssctx); 46 | calllib(obj.libname, 'ctx_DSS_ResetStringBuffer', obj.dssctx); 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /+DSS_MATLAB/ControlModes.m: -------------------------------------------------------------------------------- 1 | classdef(Enumeration) ControlModes < int32 2 | % ControlModes: enumerated values for DSS.Solution.ControlMode 3 | % 4 | % Values: 5 | % Static(0): Control Mode option - Static 6 | % Event(1): Control Mode Option - Event driven solution mode 7 | % Time(2): Control mode option - Time driven mode 8 | % Multirate(3): Control mode option - Multirate mode 9 | % Off(-1): Control Mode OFF 10 | 11 | enumeration 12 | Static(0) % Control Mode option - Static 13 | Event(1) % Control Mode Option - Event driven solution mode 14 | Time(2) % Control mode option - Time driven mode 15 | Multirate(3) % Control mode option - Multirate mode 16 | Off(-1) % Control Mode OFF 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /+DSS_MATLAB/DSSCompatFlags.m: -------------------------------------------------------------------------------- 1 | classdef(Enumeration) DSSCompatFlags < int32 2 | % DSSCompatFlags: enumerated flags for DSS.CompatFlags 3 | % 4 | % Values: 5 | % NoSolverFloatChecks(0x00000001) 6 | % BadPrecision(0x00000002) 7 | % InvControl9611(0x00000004) 8 | % SaveCalcVoltageBases(0x00000008) 9 | % 10 | % Descriptions: 11 | % 12 | % NoSolverFloatChecks: 13 | % If enabled, don't check for NaNs in the inner solution loop. 14 | % This can lead to various errors. 15 | % This flag is useful for legacy applications that don't handle OpenDSS API errors properly. 16 | % Through the development of DSS Extensions, we noticed this is actually a quite common issue. 17 | % 18 | % BadPrecision: 19 | % If enabled, toggle worse precision for certain aspects of the engine. For example, the sequence-to-phase 20 | % (`As2p`) and sequence-to-phase (`Ap2s`) transform matrices. On DSS C-API, we fill the matrix explicitly 21 | % using higher precision, while numerical inversion of an initially worse precision matrix is used in the 22 | % official OpenDSS. We will introduce better precision for other aspects of the engine in the future, 23 | % so this flag can be used to toggle the old/bad values where feasible. 24 | % 25 | % InvControl9611: 26 | % Toggle some InvControl behavior introduced in OpenDSS 9.6.1.1. It could be a regression 27 | % but needs further investigation, so we added this flag in the time being. 28 | % 29 | % SaveCalcVoltageBases: 30 | % When using "save circuit", the official OpenDSS always includes the "CalcVoltageBases" command in the 31 | % saved script. We found that it is not always a good idea, so we removed the command (leaving it commented). 32 | % Use this flag to enable the command in the saved script. 33 | % 34 | 35 | enumeration 36 | NoSolverFloatChecks(0x00000001) 37 | BadPrecision(0x00000002) 38 | InvControl9611(0x00000004) 39 | SaveCalcVoltageBases(0x00000008) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /+DSS_MATLAB/GeneratorStatus.m: -------------------------------------------------------------------------------- 1 | classdef(Enumeration) GeneratorStatus < int32 2 | % GeneratorStatus: enumerated values for Loads.Status 3 | % 4 | % Values: 5 | % Variable(0) 6 | % Fixed(1) 7 | 8 | enumeration 9 | Variable(0) 10 | Fixed(1) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /+DSS_MATLAB/IActiveClass.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IActiveClass < DSS_MATLAB.Base 2 | % IActiveClass: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % ActiveClassName - Returns name of active class. 6 | % AllNames - Array of strings consisting of all element names in the active class. 7 | % Count - Number of elements in Active Class. Same as NumElements Property. 8 | % First - 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 - 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 - Number of elements in this class. Same as Count property. 12 | % ActiveClassParent - Get the name of the parent class of the active class 13 | % 14 | % Methods: 15 | % ToJSON - Returns the data (as a list) of all elements from the active class as a JSON-encoded string. The `options` parameter contains bit-flags to toggle specific features. See `Obj_ToJSON` (C-API) for more. Additionally, the `ExcludeDisabled` flag can be used to excluded disabled elements from the output. (API Extension) 16 | 17 | properties 18 | ActiveClassName 19 | AllNames 20 | Count 21 | First 22 | Name 23 | Next 24 | NumElements 25 | ActiveClassParent 26 | end 27 | 28 | methods (Access = public) 29 | function obj = IActiveClass(apiutil) 30 | obj@DSS_MATLAB.Base(apiutil); 31 | end 32 | 33 | function result = ToJSON(obj, options) 34 | % Returns the data (as a list) of all elements from the active class as a JSON-encoded string. 35 | % 36 | % The `options` parameter contains bit-flags to toggle specific features. 37 | % See `Obj_ToJSON` (C-API) for more. 38 | % 39 | % Additionally, the `ExcludeDisabled` flag can be used to excluded disabled elements from the output. 40 | % 41 | % (API Extension) 42 | if ~exist('options', 'var') 43 | options = 0; 44 | end 45 | 46 | result = calllib(obj.libname, 'ctx_ActiveClass_ToJSON', obj.dssctx, options); 47 | obj.CheckForError(); 48 | end 49 | end 50 | methods 51 | 52 | function result = get.ActiveClassName(obj) 53 | % (read-only) Returns name of active class. 54 | result = calllib(obj.libname, 'ctx_ActiveClass_Get_ActiveClassName', obj.dssctx); 55 | obj.CheckForError(); 56 | end 57 | 58 | function result = get.AllNames(obj) 59 | % (read-only) Array of strings consisting of all element names in the active class. 60 | result = obj.apiutil.get_string_array('ctx_ActiveClass_Get_AllNames'); 61 | obj.CheckForError(); 62 | end 63 | 64 | function result = get.Count(obj) 65 | % (read-only) Number of elements in Active Class. Same as NumElements Property. 66 | result = calllib(obj.libname, 'ctx_ActiveClass_Get_Count', obj.dssctx); 67 | obj.CheckForError(); 68 | end 69 | 70 | function result = get.First(obj) 71 | % (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. 72 | result = calllib(obj.libname, 'ctx_ActiveClass_Get_First', obj.dssctx); 73 | obj.CheckForError(); 74 | end 75 | 76 | function result = get.Name(obj) 77 | % Name of the Active Element of the Active Class 78 | result = calllib(obj.libname, 'ctx_ActiveClass_Get_Name', obj.dssctx); 79 | obj.CheckForError(); 80 | end 81 | function obj = set.Name(obj, Value) 82 | calllib(obj.libname, 'ctx_ActiveClass_Set_Name', obj.dssctx, Value); 83 | obj.CheckForError(); 84 | end 85 | 86 | function result = get.Next(obj) 87 | % (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. 88 | result = calllib(obj.libname, 'ctx_ActiveClass_Get_Next', obj.dssctx); 89 | obj.CheckForError(); 90 | end 91 | 92 | function result = get.NumElements(obj) 93 | % (read-only) Number of elements in this class. Same as Count property. 94 | result = calllib(obj.libname, 'ctx_ActiveClass_Get_NumElements', obj.dssctx); 95 | obj.CheckForError(); 96 | end 97 | 98 | function result = get.ActiveClassParent(obj) 99 | % Get the name of the parent class of the active class 100 | result = calllib(obj.libname, 'ctx_ActiveClass_Get_ActiveClassParent', obj.dssctx); 101 | obj.CheckForError(); 102 | end 103 | end 104 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/ICapacitors.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) ICapacitors < DSS_MATLAB.Base 2 | % ICapacitors: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all Capacitor names 6 | % Count - Number of Capacitor objects 7 | % First - Set first object of Capacitor; returns 0 if none. 8 | % Name - Get/sets the name of the current active Capacitor 9 | % Next - Sets next Capacitor active; returns 0 if no more. 10 | % idx - Sets next Capacitor active; returns 0 if no more. 11 | % AvailableSteps - Number of Steps available in cap bank to be switched ON. 12 | % IsDelta - Delta connection or wye? 13 | % NumSteps - Number of steps (default 1) for distributing and switching the total bank kVAR. 14 | % States - A array of integer [0..numsteps-1] indicating state of each step. If the read value is -1 an error has occurred. 15 | % kV - Bank kV rating. Use LL for 2 or 3 phases, or actual can rating for 1 phase. 16 | % kvar - Total bank KVAR, distributed equally among phases and steps. 17 | % 18 | % Methods: 19 | % AddStep - 20 | % Close - 21 | % Open - 22 | % SubtractStep - 23 | 24 | properties 25 | AllNames 26 | Count 27 | First 28 | Name 29 | Next 30 | idx 31 | AvailableSteps 32 | IsDelta 33 | NumSteps 34 | States 35 | kV 36 | kvar 37 | end 38 | 39 | methods (Access = public) 40 | function obj = ICapacitors(apiutil) 41 | obj@DSS_MATLAB.Base(apiutil); 42 | end 43 | 44 | function result = AddStep(obj) 45 | result = (calllib(obj.libname, 'ctx_Capacitors_AddStep', obj.dssctx) ~= 0); 46 | obj.CheckForError(); 47 | end 48 | 49 | function obj = Close(obj) 50 | calllib(obj.libname, 'ctx_Capacitors_Close', obj.dssctx); 51 | obj.CheckForError(); 52 | end 53 | 54 | function obj = Open(obj) 55 | calllib(obj.libname, 'ctx_Capacitors_Open', obj.dssctx); 56 | obj.CheckForError(); 57 | end 58 | 59 | function result = SubtractStep(obj) 60 | result = (calllib(obj.libname, 'ctx_Capacitors_SubtractStep', obj.dssctx) ~= 0); 61 | obj.CheckForError(); 62 | end 63 | 64 | end 65 | methods 66 | 67 | function result = get.AllNames(obj) 68 | % Array of strings with all Capacitor names 69 | result = obj.apiutil.get_string_array('ctx_Capacitors_Get_AllNames'); 70 | end 71 | 72 | function result = get.Count(obj) 73 | % Number of Capacitor objects 74 | result = calllib(obj.libname, 'ctx_Capacitors_Get_Count', obj.dssctx); 75 | end 76 | 77 | function result = get.First(obj) 78 | % Set first object of Capacitor; returns 0 if none. 79 | result = calllib(obj.libname, 'ctx_Capacitors_Get_First', obj.dssctx); 80 | end 81 | 82 | function result = get.Name(obj) 83 | % Get/sets the name of the current active Capacitor 84 | result = calllib(obj.libname, 'ctx_Capacitors_Get_Name', obj.dssctx); 85 | end 86 | function obj = set.Name(obj, Value) 87 | calllib(obj.libname, 'ctx_Capacitors_Set_Name', obj.dssctx, Value); 88 | obj.CheckForError(); 89 | end 90 | 91 | function result = get.Next(obj) 92 | % Sets next Capacitor active; returns 0 if no more. 93 | result = calllib(obj.libname, 'ctx_Capacitors_Get_Next', obj.dssctx); 94 | end 95 | 96 | function result = get.idx(obj) 97 | % Get/set active Capacitor by index; 1..Count 98 | result = calllib(obj.libname, 'ctx_Capacitors_Get_idx', obj.dssctx); 99 | end 100 | function obj = set.idx(obj, Value) 101 | calllib(obj.libname, 'ctx_Capacitors_Set_idx', obj.dssctx, Value); 102 | obj.CheckForError(); 103 | end 104 | 105 | 106 | function result = get.AvailableSteps(obj) 107 | % Number of Steps available in cap bank to be switched ON. 108 | result = calllib(obj.libname, 'ctx_Capacitors_Get_AvailableSteps', obj.dssctx); 109 | obj.CheckForError(); 110 | end 111 | 112 | function result = get.IsDelta(obj) 113 | % Delta connection or wye? 114 | result = (calllib(obj.libname, 'ctx_Capacitors_Get_IsDelta', obj.dssctx) ~= 0); 115 | obj.CheckForError(); 116 | end 117 | function obj = set.IsDelta(obj, Value) 118 | calllib(obj.libname, 'ctx_Capacitors_Set_IsDelta', obj.dssctx, Value); 119 | obj.CheckForError(); 120 | end 121 | 122 | function result = get.NumSteps(obj) 123 | % Number of steps (default 1) for distributing and switching the total bank kVAR. 124 | result = calllib(obj.libname, 'ctx_Capacitors_Get_NumSteps', obj.dssctx); 125 | obj.CheckForError(); 126 | end 127 | function obj = set.NumSteps(obj, Value) 128 | calllib(obj.libname, 'ctx_Capacitors_Set_NumSteps', obj.dssctx, Value); 129 | obj.CheckForError(); 130 | end 131 | 132 | function result = get.States(obj) 133 | % A array of integer [0..numsteps-1] indicating state of each step. If the read value is -1 an error has occurred. 134 | calllib(obj.libname, 'ctx_Capacitors_Get_States_GR', obj.dssctx); 135 | obj.CheckForError(); 136 | result = obj.apiutil.get_int32_gr_array(); 137 | end 138 | function obj = set.States(obj, Value) 139 | calllib(obj.libname, 'ctx_Capacitors_Set_States', obj.dssctx, Value, numel(Value)); 140 | obj.CheckForError(); 141 | end 142 | 143 | function result = get.kV(obj) 144 | % Bank kV rating. Use LL for 2 or 3 phases, or actual can rating for 1 phase. 145 | result = calllib(obj.libname, 'ctx_Capacitors_Get_kV', obj.dssctx); 146 | obj.CheckForError(); 147 | end 148 | function obj = set.kV(obj, Value) 149 | calllib(obj.libname, 'ctx_Capacitors_Set_kV', obj.dssctx, Value); 150 | obj.CheckForError(); 151 | end 152 | 153 | function result = get.kvar(obj) 154 | % Total bank KVAR, distributed equally among phases and steps. 155 | result = calllib(obj.libname, 'ctx_Capacitors_Get_kvar', obj.dssctx); 156 | obj.CheckForError(); 157 | end 158 | function obj = set.kvar(obj, Value) 159 | calllib(obj.libname, 'ctx_Capacitors_Set_kvar', obj.dssctx, Value); 160 | obj.CheckForError(); 161 | end 162 | end 163 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/ICtrlQueue.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) ICtrlQueue < DSS_MATLAB.Base 2 | % ICtrlQueue: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % ActionCode - Code for the active action. Long integer code to tell the control device what to do 6 | % DeviceHandle - Handle (User defined) to device that must act on the pending action. 7 | % NumActions - Number of Actions on the current actionlist (that have been popped off the control queue by CheckControlActions) 8 | % PopAction - Pops next action off the action list and makes it the active action. Returns zero if none. 9 | % Queue - Array of strings containing the entire queue in CSV format 10 | % QueueSize - Number of items on the OpenDSS control Queue 11 | % Action - (write-only) Set the active action by index 12 | % 13 | % Methods: 14 | % ClearActions - 15 | % ClearQueue - 16 | % Delete - 17 | % DoAllQueue - 18 | % Show - 19 | % Push - Push a control action onto the DSS control queue by time, action code, and device handle (user defined). Returns Control Queue handle. 20 | 21 | properties 22 | ActionCode 23 | DeviceHandle 24 | NumActions 25 | PopAction 26 | Queue 27 | QueueSize 28 | Action 29 | end 30 | 31 | methods (Access = public) 32 | function obj = ICtrlQueue(apiutil) 33 | obj@DSS_MATLAB.Base(apiutil); 34 | end 35 | 36 | function obj = ClearActions(obj) 37 | calllib(obj.libname, 'ctx_CtrlQueue_ClearActions', obj.dssctx); 38 | obj.CheckForError(); 39 | end 40 | 41 | function obj = ClearQueue(obj) 42 | calllib(obj.libname, 'ctx_CtrlQueue_ClearQueue', obj.dssctx); 43 | obj.CheckForError(); 44 | end 45 | 46 | function obj = Delete(obj, ActionHandle) 47 | calllib(obj.libname, 'ctx_CtrlQueue_Delete', obj.dssctx, ActionHandle); 48 | obj.CheckForError(); 49 | end 50 | 51 | function obj = DoAllQueue(obj) 52 | calllib(obj.libname, 'ctx_CtrlQueue_DoAllQueue', obj.dssctx); 53 | obj.CheckForError(); 54 | end 55 | 56 | function obj = Show(obj) 57 | calllib(obj.libname, 'ctx_CtrlQueue_Show', obj.dssctx); 58 | obj.CheckForError(); 59 | end 60 | 61 | function result = Push(obj, Hour, Seconds, ActionCode, DeviceHandle) 62 | % Push a control action onto the DSS control queue by time, action code, and device handle (user defined). Returns Control Queue handle. 63 | result = calllib(obj.libname, 'ctx_CtrlQueue_Push', obj.dssctx, Hour, Seconds, ActionCode, DeviceHandle); 64 | obj.CheckForError(); 65 | end 66 | 67 | end 68 | methods 69 | 70 | function result = get.ActionCode(obj) 71 | % Code for the active action. Long integer code to tell the control device what to do 72 | result = calllib(obj.libname, 'ctx_CtrlQueue_Get_ActionCode', obj.dssctx); 73 | obj.CheckForError(); 74 | end 75 | 76 | function result = get.DeviceHandle(obj) 77 | % Handle (User defined) to device that must act on the pending action. 78 | result = calllib(obj.libname, 'ctx_CtrlQueue_Get_DeviceHandle', obj.dssctx); 79 | obj.CheckForError(); 80 | end 81 | 82 | function result = get.NumActions(obj) 83 | % Number of Actions on the current actionlist (that have been popped off the control queue by CheckControlActions) 84 | result = calllib(obj.libname, 'ctx_CtrlQueue_Get_NumActions', obj.dssctx); 85 | obj.CheckForError(); 86 | end 87 | 88 | function result = get.PopAction(obj) 89 | % Pops next action off the action list and makes it the active action. Returns zero if none. 90 | result = calllib(obj.libname, 'ctx_CtrlQueue_Get_PopAction', obj.dssctx); 91 | obj.CheckForError(); 92 | end 93 | 94 | function result = get.Queue(obj) 95 | % Array of strings containing the entire queue in CSV format 96 | result = obj.apiutil.get_string_array('ctx_CtrlQueue_Get_Queue'); 97 | obj.CheckForError(); 98 | end 99 | 100 | function result = get.QueueSize(obj) 101 | % Number of items on the OpenDSS control Queue 102 | result = calllib(obj.libname, 'ctx_CtrlQueue_Get_QueueSize', obj.dssctx); 103 | obj.CheckForError(); 104 | end 105 | 106 | function result = get.Action(obj) 107 | % (write-only) Set the active action by index 108 | ME = MException(['DSS_MATLAB:Error'], 'This property is write-only!'); throw(ME); 109 | end 110 | function obj = set.Action(obj, Param1) 111 | calllib(obj.libname, 'ctx_CtrlQueue_Set_Action', obj.dssctx, Param1); 112 | obj.CheckForError(); 113 | end 114 | end 115 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IDSSElement.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IDSSElement < DSS_MATLAB.Base 2 | % IDSSElement: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % Properties - 6 | % AllPropertyNames - Array of strings containing the names of all properties for the active DSS object. 7 | % Name - Full Name of Active DSS Object (general element or circuit element). 8 | % NumProperties - Number of Properties for the active DSS object. 9 | % 10 | % Methods: 11 | % ToJSON - Returns the properties of the active DSS object as a JSON-encoded string. The `options` parameter contains bit-flags to toggle specific features. See `Obj_ToJSON` (C-API) for more. (API Extension) 12 | 13 | properties 14 | Properties 15 | AllPropertyNames 16 | Name 17 | NumProperties 18 | end 19 | 20 | methods (Access = public) 21 | function obj = IDSSElement(apiutil) 22 | obj@DSS_MATLAB.Base(apiutil); 23 | obj.Properties = DSS_MATLAB.IDSSProperty(obj.apiutil); 24 | end 25 | 26 | function result = ToJSON(obj, options) 27 | % Returns the properties of the active DSS object as a JSON-encoded string. 28 | % 29 | % The `options` parameter contains bit-flags to toggle specific features. 30 | % See `Obj_ToJSON` (C-API) for more 31 | % 32 | % (API Extension) 33 | if ~exist('options', 'var') 34 | options = 0; 35 | end 36 | 37 | result = calllib(obj.libname, 'ctx_DSSElement_ToJSON', obj.dssctx, options); 38 | obj.CheckForError(); 39 | end 40 | end 41 | methods 42 | 43 | function result = get.AllPropertyNames(obj) 44 | % Array of strings containing the names of all properties for the active DSS object. 45 | result = obj.apiutil.get_string_array('ctx_DSSElement_Get_AllPropertyNames'); 46 | obj.CheckForError(); 47 | end 48 | 49 | function result = get.Name(obj) 50 | % Full Name of Active DSS Object (general element or circuit element). 51 | result = calllib(obj.libname, 'ctx_DSSElement_Get_Name', obj.dssctx); 52 | obj.CheckForError(); 53 | end 54 | 55 | function result = get.NumProperties(obj) 56 | % Number of Properties for the active DSS object. 57 | result = calllib(obj.libname, 'ctx_DSSElement_Get_NumProperties', obj.dssctx); 58 | obj.CheckForError(); 59 | end 60 | end 61 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IDSSEvents.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IDSSEvents < DSS_MATLAB.Base 2 | % IDSSEvents: DSS MATLAB interface class to DSS C-API 3 | 4 | methods (Access = public) 5 | function obj = IDSSEvents(apiutil) 6 | obj@DSS_MATLAB.Base(apiutil); 7 | end 8 | end 9 | 10 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IDSSProgress.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IDSSProgress < DSS_MATLAB.Base 2 | % IDSSProgress: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % Caption - (write-only) Caption to appear on the bottom of the DSS Progress form. 6 | % PctProgress - (write-only) Percent progress to indicate [0..100] 7 | % 8 | % Methods: 9 | % Close - 10 | % Show - 11 | 12 | properties 13 | Caption 14 | PctProgress 15 | end 16 | 17 | methods (Access = public) 18 | function obj = IDSSProgress(apiutil) 19 | obj@DSS_MATLAB.Base(apiutil); 20 | end 21 | 22 | function obj = Close(obj) 23 | calllib(obj.libname, 'ctx_DSSProgress_Close', obj.dssctx); 24 | obj.CheckForError(); 25 | end 26 | 27 | function obj = Show(obj) 28 | calllib(obj.libname, 'ctx_DSSProgress_Show', obj.dssctx); 29 | obj.CheckForError(); 30 | end 31 | 32 | end 33 | methods 34 | 35 | function result = get.Caption(obj) 36 | % (write-only) Caption to appear on the bottom of the DSS Progress form. 37 | ME = MException(['DSS_MATLAB:Error'], 'This property is write-only!'); throw(ME); 38 | end 39 | function obj = set.Caption(obj, Value) 40 | calllib(obj.libname, 'ctx_DSSProgress_Set_Caption', obj.dssctx, Value); 41 | obj.CheckForError(); 42 | end 43 | 44 | function result = get.PctProgress(obj) 45 | % (write-only) Percent progress to indicate [0..100] 46 | ME = MException(['DSS_MATLAB:Error'], 'This property is write-only!'); throw(ME); 47 | end 48 | function obj = set.PctProgress(obj, Value) 49 | calllib(obj.libname, 'ctx_DSSProgress_Set_PctProgress', obj.dssctx, Value); 50 | obj.CheckForError(); 51 | end 52 | end 53 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IDSSProperty.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IDSSProperty < DSS_MATLAB.Base 2 | % IDSSProperty: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % Description - Description of the property. 6 | % Name - Name of Property 7 | % Val - 8 | 9 | properties 10 | Description 11 | Name 12 | Val 13 | end 14 | 15 | methods (Access = public) 16 | function obj = IDSSProperty(apiutil) 17 | obj@DSS_MATLAB.Base(apiutil); 18 | end 19 | 20 | end 21 | methods 22 | 23 | function result = get.Description(obj) 24 | % Description of the property. 25 | result = calllib(obj.libname, 'ctx_DSSProperty_Get_Description', obj.dssctx); 26 | obj.CheckForError(); 27 | end 28 | 29 | function result = get.Name(obj) 30 | % Name of Property 31 | result = calllib(obj.libname, 'ctx_DSSProperty_Get_Name', obj.dssctx); 32 | obj.CheckForError(); 33 | end 34 | 35 | function result = get.Val(obj) 36 | result = calllib(obj.libname, 'ctx_DSSProperty_Get_Val', obj.dssctx); 37 | obj.CheckForError(); 38 | end 39 | function obj = set.Val(obj, Value) 40 | calllib(obj.libname, 'ctx_DSSProperty_Set_Val', obj.dssctx, Value); 41 | obj.CheckForError(); 42 | end 43 | end 44 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IDSS_Executive.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IDSS_Executive < DSS_MATLAB.Base 2 | % IDSS_Executive: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % NumCommands - Number of DSS Executive Commands 6 | % NumOptions - Number of DSS Executive Options 7 | % 8 | % Methods: 9 | % Command - Get i-th command 10 | % CommandHelp - Get help string for i-th command 11 | % Option - Get i-th option 12 | % OptionHelp - Get help string for i-th option 13 | % OptionValue - Get present value of i-th option 14 | 15 | properties 16 | NumCommands 17 | NumOptions 18 | end 19 | 20 | methods (Access = public) 21 | function obj = IDSS_Executive(apiutil) 22 | obj@DSS_MATLAB.Base(apiutil); 23 | end 24 | 25 | function result = Command(obj, i) 26 | % Get i-th command 27 | result = calllib(obj.libname, 'ctx_DSS_Executive_Get_Command', obj.dssctx, i); 28 | obj.CheckForError(); 29 | end 30 | 31 | function result = CommandHelp(obj, i) 32 | % Get help string for i-th command 33 | result = calllib(obj.libname, 'ctx_DSS_Executive_Get_CommandHelp', obj.dssctx, i); 34 | obj.CheckForError(); 35 | end 36 | 37 | function result = Option(obj, i) 38 | % Get i-th option 39 | result = calllib(obj.libname, 'ctx_DSS_Executive_Get_Option', obj.dssctx, i); 40 | obj.CheckForError(); 41 | end 42 | 43 | function result = OptionHelp(obj, i) 44 | % Get help string for i-th option 45 | result = calllib(obj.libname, 'ctx_DSS_Executive_Get_OptionHelp', obj.dssctx, i); 46 | obj.CheckForError(); 47 | end 48 | 49 | function result = OptionValue(obj, i) 50 | % Get present value of i-th option 51 | result = calllib(obj.libname, 'ctx_DSS_Executive_Get_OptionValue', obj.dssctx, i); 52 | obj.CheckForError(); 53 | end 54 | 55 | end 56 | methods 57 | 58 | function result = get.NumCommands(obj) 59 | % Number of DSS Executive Commands 60 | result = calllib(obj.libname, 'ctx_DSS_Executive_Get_NumCommands', obj.dssctx); 61 | obj.CheckForError(); 62 | end 63 | 64 | function result = get.NumOptions(obj) 65 | % Number of DSS Executive Options 66 | result = calllib(obj.libname, 'ctx_DSS_Executive_Get_NumOptions', obj.dssctx); 67 | obj.CheckForError(); 68 | end 69 | end 70 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IDSSimComs.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IDSSimComs < DSS_MATLAB.Base 2 | % IDSSimComs: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Methods: 5 | % BusVoltage - 6 | % BusVoltagepu - 7 | 8 | methods (Access = public) 9 | function obj = IDSSimComs(apiutil) 10 | obj@DSS_MATLAB.Base(apiutil); 11 | end 12 | 13 | function result = BusVoltage(obj, Index) 14 | calllib(obj.libname, 'ctx_DSSimComs_BusVoltage_GR', obj.dssctx, Index); 15 | obj.CheckForError(); 16 | result = obj.apiutil.get_float64_gr_array(); 17 | end 18 | 19 | function result = BusVoltagepu(obj, Index) 20 | calllib(obj.libname, 'ctx_DSSimComs_BusVoltagepu_GR', obj.dssctx, Index); 21 | obj.CheckForError(); 22 | result = obj.apiutil.get_float64_gr_array(); 23 | end 24 | end 25 | methods 26 | 27 | end 28 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IError.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IError < DSS_MATLAB.Base 2 | % IError: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % Description - Description of error for last operation 6 | % Number - Error Number (returns current value and then resets to zero) 7 | % EarlyAbort - EarlyAbort controls whether all errors halts the DSS script processing (Compile/Redirect), defaults to True. (API Extension) 8 | % ExtendedErrors - Controls whether the extended error mechanism is used. Defaults to True. Extended errors are errors derived from checks across the API to ensure a valid state. Although many of these checks are already present in the original/official COM interface, the checks do not produce any error message. An error value can be returned by a function but this value can, for many of the functions, be a valid value. As such, the user has no means to detect an invalid API call. Extended errors use the Error interface to provide a more clear message and should help users, especially new users, to find usage issues earlier. At Python level, an exception is raised when an error is detected through the Error interface. The current default state is ON. For compatibility, the user can turn it off to restore the previous behavior. (API Extension) 9 | 10 | properties 11 | Description 12 | Number 13 | EarlyAbort 14 | ExtendedErrors 15 | end 16 | 17 | methods (Access = public) 18 | function obj = IError(apiutil) 19 | obj@DSS_MATLAB.Base(apiutil); 20 | end 21 | 22 | end 23 | methods 24 | 25 | function result = get.Description(obj) 26 | % Description of error for last operation 27 | result = calllib(obj.libname, 'ctx_Error_Get_Description', obj.dssctx); 28 | end 29 | 30 | function result = get.Number(obj) 31 | % Error Number (returns current value and then resets to zero) 32 | result = calllib(obj.libname, 'ctx_Error_Get_Number', obj.dssctx); 33 | end 34 | 35 | function result = get.EarlyAbort(obj) 36 | % EarlyAbort controls whether all errors halts the DSS script processing (Compile/Redirect), defaults to True. 37 | % 38 | % (API Extension) 39 | result = (calllib(obj.libname, 'ctx_Error_Get_EarlyAbort', obj.dssctx) ~= 0); 40 | end 41 | function obj = set.EarlyAbort(obj, Value) 42 | calllib(obj.libname, 'ctx_Error_Set_EarlyAbort', obj.dssctx, Value); 43 | end 44 | 45 | function result = get.ExtendedErrors(obj) 46 | % Controls whether the extended error mechanism is used. Defaults to True. 47 | % 48 | % Extended errors are errors derived from checks across the API to ensure 49 | % a valid state. Although many of these checks are already present in the 50 | % original/official COM interface, the checks do not produce any error 51 | % message. An error value can be returned by a function but this value 52 | % can, for many of the functions, be a valid value. As such, the user 53 | % has no means to detect an invalid API call. 54 | % 55 | % Extended errors use the Error interface to provide a more clear message 56 | % and should help users, especially new users, to find usage issues earlier. 57 | % 58 | % At MATLAB level, an exception is raised when an error is detected through 59 | % the Error interface. 60 | % 61 | % The current default state is ON. For compatibility, the user can turn it 62 | % off to restore the previous behavior. 63 | % 64 | % (API Extension) 65 | result = (calllib(obj.libname, 'ctx_Error_Get_ExtendedErrors', obj.dssctx) ~= 0); 66 | end 67 | function obj = set.ExtendedErrors(obj, Value) 68 | calllib(obj.libname, 'ctx_Error_Set_ExtendedErrors', obj.dssctx, Value); 69 | end 70 | end 71 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IFuses.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IFuses < DSS_MATLAB.Base 2 | % IFuses: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all Fuse names 6 | % Count - Number of Fuse objects 7 | % First - Set first object of Fuse; returns 0 if none. 8 | % Name - Get/sets the name of the current active Fuse 9 | % Next - Sets next Fuse active; returns 0 if no more. 10 | % idx - Sets next Fuse active; returns 0 if no more. 11 | % Delay - A fixed delay time in seconds added to the fuse blowing time determined by the TCC curve. Default is 0. This represents a fuse clear or other delay. 12 | % MonitoredObj - Full name of the circuit element to which the fuse is connected. 13 | % MonitoredTerm - Terminal number to which the fuse is connected. 14 | % NumPhases - Number of phases, this fuse. 15 | % RatedCurrent - Multiplier or actual amps for the TCCcurve object. Defaults to 1.0. Multiply current values of TCC curve by this to get actual amps. 16 | % SwitchedObj - Full name of the circuit element switch that the fuse controls. Defaults to the MonitoredObj. 17 | % SwitchedTerm - Number of the terminal of the controlled element containing the switch controlled by the fuse. 18 | % TCCcurve - Name of the TCCcurve object that determines fuse blowing. 19 | % State - Array of strings indicating the state of each phase of the fuse. 20 | % NormalState - Array of strings indicating the normal state of each phase of the fuse. 21 | % 22 | % Methods: 23 | % Close - Close all phases of the fuse. 24 | % IsBlown - Current state of the fuses. TRUE if any fuse on any phase is blown. Else FALSE. 25 | % Open - Manual opening of all phases of the fuse. 26 | % Reset - Reset fuse to normal state. 27 | 28 | properties 29 | AllNames 30 | Count 31 | First 32 | Name 33 | Next 34 | idx 35 | Delay 36 | MonitoredObj 37 | MonitoredTerm 38 | NumPhases 39 | RatedCurrent 40 | SwitchedObj 41 | SwitchedTerm 42 | TCCcurve 43 | State 44 | NormalState 45 | end 46 | 47 | methods (Access = public) 48 | function obj = IFuses(apiutil) 49 | obj@DSS_MATLAB.Base(apiutil); 50 | end 51 | 52 | function obj = Close(obj) 53 | % Close all phases of the fuse. 54 | calllib(obj.libname, 'ctx_Fuses_Close', obj.dssctx); 55 | obj.CheckForError(); 56 | end 57 | 58 | function result = IsBlown(obj) 59 | % Current state of the fuses. TRUE if any fuse on any phase is blown. Else FALSE. 60 | result = (calllib(obj.libname, 'ctx_Fuses_IsBlown', obj.dssctx) ~= 0); 61 | obj.CheckForError(); 62 | end 63 | 64 | function obj = Open(obj) 65 | % Manual opening of all phases of the fuse. 66 | calllib(obj.libname, 'ctx_Fuses_Open', obj.dssctx); 67 | obj.CheckForError(); 68 | end 69 | 70 | function obj = Reset(obj) 71 | % Reset fuse to normal state. 72 | calllib(obj.libname, 'ctx_Fuses_Reset', obj.dssctx); 73 | obj.CheckForError(); 74 | end 75 | 76 | end 77 | methods 78 | 79 | function result = get.AllNames(obj) 80 | % Array of strings with all Fuse names 81 | result = obj.apiutil.get_string_array('ctx_Fuses_Get_AllNames'); 82 | end 83 | 84 | function result = get.Count(obj) 85 | % Number of Fuse objects 86 | result = calllib(obj.libname, 'ctx_Fuses_Get_Count', obj.dssctx); 87 | end 88 | 89 | function result = get.First(obj) 90 | % Set first object of Fuse; returns 0 if none. 91 | result = calllib(obj.libname, 'ctx_Fuses_Get_First', obj.dssctx); 92 | end 93 | 94 | function result = get.Name(obj) 95 | % Get/sets the name of the current active Fuse 96 | result = calllib(obj.libname, 'ctx_Fuses_Get_Name', obj.dssctx); 97 | end 98 | function obj = set.Name(obj, Value) 99 | calllib(obj.libname, 'ctx_Fuses_Set_Name', obj.dssctx, Value); 100 | obj.CheckForError(); 101 | end 102 | 103 | function result = get.Next(obj) 104 | % Sets next Fuse active; returns 0 if no more. 105 | result = calllib(obj.libname, 'ctx_Fuses_Get_Next', obj.dssctx); 106 | end 107 | 108 | function result = get.idx(obj) 109 | % Get/set active Fuse by index; 1..Count 110 | result = calllib(obj.libname, 'ctx_Fuses_Get_idx', obj.dssctx); 111 | end 112 | function obj = set.idx(obj, Value) 113 | calllib(obj.libname, 'ctx_Fuses_Set_idx', obj.dssctx, Value); 114 | obj.CheckForError(); 115 | end 116 | 117 | 118 | function result = get.Delay(obj) 119 | % A fixed delay time in seconds added to the fuse blowing time determined by the TCC curve. Default is 0. 120 | % This represents a fuse clear or other delay. 121 | result = calllib(obj.libname, 'ctx_Fuses_Get_Delay', obj.dssctx); 122 | obj.CheckForError(); 123 | end 124 | function obj = set.Delay(obj, Value) 125 | calllib(obj.libname, 'ctx_Fuses_Set_Delay', obj.dssctx, Value); 126 | obj.CheckForError(); 127 | end 128 | 129 | function result = get.MonitoredObj(obj) 130 | % Full name of the circuit element to which the fuse is connected. 131 | result = calllib(obj.libname, 'ctx_Fuses_Get_MonitoredObj', obj.dssctx); 132 | obj.CheckForError(); 133 | end 134 | function obj = set.MonitoredObj(obj, Value) 135 | calllib(obj.libname, 'ctx_Fuses_Set_MonitoredObj', obj.dssctx, Value); 136 | obj.CheckForError(); 137 | end 138 | 139 | function result = get.MonitoredTerm(obj) 140 | % Terminal number to which the fuse is connected. 141 | result = calllib(obj.libname, 'ctx_Fuses_Get_MonitoredTerm', obj.dssctx); 142 | obj.CheckForError(); 143 | end 144 | function obj = set.MonitoredTerm(obj, Value) 145 | calllib(obj.libname, 'ctx_Fuses_Set_MonitoredTerm', obj.dssctx, Value); 146 | obj.CheckForError(); 147 | end 148 | 149 | function result = get.NumPhases(obj) 150 | % Number of phases, this fuse. 151 | result = calllib(obj.libname, 'ctx_Fuses_Get_NumPhases', obj.dssctx); 152 | obj.CheckForError(); 153 | end 154 | 155 | function result = get.RatedCurrent(obj) 156 | % Multiplier or actual amps for the TCCcurve object. Defaults to 1.0. 157 | % Multiply current values of TCC curve by this to get actual amps. 158 | result = calllib(obj.libname, 'ctx_Fuses_Get_RatedCurrent', obj.dssctx); 159 | obj.CheckForError(); 160 | end 161 | function obj = set.RatedCurrent(obj, Value) 162 | calllib(obj.libname, 'ctx_Fuses_Set_RatedCurrent', obj.dssctx, Value); 163 | obj.CheckForError(); 164 | end 165 | 166 | function result = get.SwitchedObj(obj) 167 | % Full name of the circuit element switch that the fuse controls. 168 | % Defaults to the MonitoredObj. 169 | result = calllib(obj.libname, 'ctx_Fuses_Get_SwitchedObj', obj.dssctx); 170 | obj.CheckForError(); 171 | end 172 | function obj = set.SwitchedObj(obj, Value) 173 | calllib(obj.libname, 'ctx_Fuses_Set_SwitchedObj', obj.dssctx, Value); 174 | obj.CheckForError(); 175 | end 176 | 177 | function result = get.SwitchedTerm(obj) 178 | % Number of the terminal of the controlled element containing the switch controlled by the fuse. 179 | result = calllib(obj.libname, 'ctx_Fuses_Get_SwitchedTerm', obj.dssctx); 180 | obj.CheckForError(); 181 | end 182 | function obj = set.SwitchedTerm(obj, Value) 183 | calllib(obj.libname, 'ctx_Fuses_Set_SwitchedTerm', obj.dssctx, Value); 184 | obj.CheckForError(); 185 | end 186 | 187 | function result = get.TCCcurve(obj) 188 | % Name of the TCCcurve object that determines fuse blowing. 189 | result = calllib(obj.libname, 'ctx_Fuses_Get_TCCcurve', obj.dssctx); 190 | obj.CheckForError(); 191 | end 192 | function obj = set.TCCcurve(obj, Value) 193 | calllib(obj.libname, 'ctx_Fuses_Set_TCCcurve', obj.dssctx, Value); 194 | obj.CheckForError(); 195 | end 196 | 197 | function result = get.State(obj) 198 | % Array of strings indicating the state of each phase of the fuse. 199 | result = obj.apiutil.get_string_array('ctx_Fuses_Get_State'); 200 | obj.CheckForError(); 201 | end 202 | function obj = set.State(obj, Value) 203 | obj.apiutil.set_string_array('ctx_Fuses_Set_State', Value); 204 | obj.CheckForError(); 205 | end 206 | 207 | function result = get.NormalState(obj) 208 | % Array of strings indicating the normal state of each phase of the fuse. 209 | result = obj.apiutil.get_string_array('ctx_Fuses_Get_NormalState'); 210 | obj.CheckForError(); 211 | end 212 | function obj = set.NormalState(obj, Value) 213 | obj.apiutil.set_string_array('ctx_Fuses_Set_NormalState', Value); 214 | obj.CheckForError(); 215 | end 216 | end 217 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IGICSources.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IGICSources < DSS_MATLAB.Base 2 | % IGICSources: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all GICSource names 6 | % Count - Number of GICSource objects 7 | % First - Set first object of GICSource; returns 0 if none. 8 | % Name - Get/sets the name of the current active GICSource 9 | % Next - Sets next GICSource active; returns 0 if no more. 10 | % idx - Sets next GICSource active; returns 0 if no more. 11 | % Bus1 - First bus name of GICSource (Created name) 12 | % Bus2 - Second bus name 13 | % Phases - Number of Phases, this GICSource element. 14 | % EN - Northward E Field V/km 15 | % EE - Eastward E Field, V/km 16 | % Lat1 - Latitude of Bus1 (degrees) 17 | % Lat2 - Latitude of Bus2 (degrees) 18 | % Lon1 - Longitude of Bus1 (Degrees) 19 | % Lon2 - Longitude of Bus2 (Degrees) 20 | % Volts - Specify dc voltage directly 21 | 22 | properties 23 | AllNames 24 | Count 25 | First 26 | Name 27 | Next 28 | idx 29 | Bus1 30 | Bus2 31 | Phases 32 | EN 33 | EE 34 | Lat1 35 | Lat2 36 | Lon1 37 | Lon2 38 | Volts 39 | end 40 | 41 | methods (Access = public) 42 | function obj = IGICSources(apiutil) 43 | obj@DSS_MATLAB.Base(apiutil); 44 | end 45 | 46 | end 47 | methods 48 | 49 | function result = get.AllNames(obj) 50 | % Array of strings with all GICSource names 51 | result = obj.apiutil.get_string_array('ctx_GICSources_Get_AllNames'); 52 | end 53 | 54 | function result = get.Count(obj) 55 | % Number of GICSource objects 56 | result = calllib(obj.libname, 'ctx_GICSources_Get_Count', obj.dssctx); 57 | end 58 | 59 | function result = get.First(obj) 60 | % Set first object of GICSource; returns 0 if none. 61 | result = calllib(obj.libname, 'ctx_GICSources_Get_First', obj.dssctx); 62 | end 63 | 64 | function result = get.Name(obj) 65 | % Get/sets the name of the current active GICSource 66 | result = calllib(obj.libname, 'ctx_GICSources_Get_Name', obj.dssctx); 67 | end 68 | function obj = set.Name(obj, Value) 69 | calllib(obj.libname, 'ctx_GICSources_Set_Name', obj.dssctx, Value); 70 | obj.CheckForError(); 71 | end 72 | 73 | function result = get.Next(obj) 74 | % Sets next GICSource active; returns 0 if no more. 75 | result = calllib(obj.libname, 'ctx_GICSources_Get_Next', obj.dssctx); 76 | end 77 | 78 | function result = get.idx(obj) 79 | % Get/set active GICSource by index; 1..Count 80 | result = calllib(obj.libname, 'ctx_GICSources_Get_idx', obj.dssctx); 81 | end 82 | function obj = set.idx(obj, Value) 83 | calllib(obj.libname, 'ctx_GICSources_Set_idx', obj.dssctx, Value); 84 | obj.CheckForError(); 85 | end 86 | 87 | 88 | function result = get.Bus1(obj) 89 | % First bus name of GICSource (Created name) 90 | result = calllib(obj.libname, 'ctx_GICSources_Get_Bus1', obj.dssctx); 91 | obj.CheckForError(); 92 | end 93 | 94 | function result = get.Bus2(obj) 95 | % Second bus name 96 | result = calllib(obj.libname, 'ctx_GICSources_Get_Bus2', obj.dssctx); 97 | obj.CheckForError(); 98 | end 99 | 100 | function result = get.Phases(obj) 101 | % Number of Phases, this GICSource element. 102 | result = calllib(obj.libname, 'ctx_GICSources_Get_Phases', obj.dssctx); 103 | obj.CheckForError(); 104 | end 105 | function obj = set.Phases(obj, Value) 106 | calllib(obj.libname, 'ctx_GICSources_Set_Phases', obj.dssctx, Value); 107 | obj.CheckForError(); 108 | end 109 | 110 | function result = get.EN(obj) 111 | % Northward E Field V/km 112 | result = calllib(obj.libname, 'ctx_GICSources_Get_EN', obj.dssctx); 113 | obj.CheckForError(); 114 | end 115 | function obj = set.EN(obj, Value) 116 | calllib(obj.libname, 'ctx_GICSources_Set_EN', obj.dssctx, Value); 117 | obj.CheckForError(); 118 | end 119 | 120 | function result = get.EE(obj) 121 | % Eastward E Field, V/km 122 | result = calllib(obj.libname, 'ctx_GICSources_Get_EE', obj.dssctx); 123 | obj.CheckForError(); 124 | end 125 | function obj = set.EE(obj, Value) 126 | calllib(obj.libname, 'ctx_GICSources_Set_EE', obj.dssctx, Value); 127 | obj.CheckForError(); 128 | end 129 | 130 | function result = get.Lat1(obj) 131 | % Latitude of Bus1 (degrees) 132 | result = calllib(obj.libname, 'ctx_GICSources_Get_Lat1', obj.dssctx); 133 | obj.CheckForError(); 134 | end 135 | function obj = set.Lat1(obj, Value) 136 | calllib(obj.libname, 'ctx_GICSources_Set_Lat1', obj.dssctx, Value); 137 | obj.CheckForError(); 138 | end 139 | 140 | function result = get.Lat2(obj) 141 | % Latitude of Bus2 (degrees) 142 | result = calllib(obj.libname, 'ctx_GICSources_Get_Lat2', obj.dssctx); 143 | obj.CheckForError(); 144 | end 145 | function obj = set.Lat2(obj, Value) 146 | calllib(obj.libname, 'ctx_GICSources_Set_Lat2', obj.dssctx, Value); 147 | obj.CheckForError(); 148 | end 149 | 150 | function result = get.Lon1(obj) 151 | % Longitude of Bus1 (Degrees) 152 | result = calllib(obj.libname, 'ctx_GICSources_Get_Lon1', obj.dssctx); 153 | obj.CheckForError(); 154 | end 155 | function obj = set.Lon1(obj, Value) 156 | calllib(obj.libname, 'ctx_GICSources_Set_Lon1', obj.dssctx, Value); 157 | obj.CheckForError(); 158 | end 159 | 160 | function result = get.Lon2(obj) 161 | % Longitude of Bus2 (Degrees) 162 | result = calllib(obj.libname, 'ctx_GICSources_Get_Lon2', obj.dssctx); 163 | obj.CheckForError(); 164 | end 165 | function obj = set.Lon2(obj, Value) 166 | calllib(obj.libname, 'ctx_GICSources_Set_Lon2', obj.dssctx, Value); 167 | obj.CheckForError(); 168 | end 169 | 170 | function result = get.Volts(obj) 171 | % Specify dc voltage directly 172 | result = calllib(obj.libname, 'ctx_GICSources_Get_Volts', obj.dssctx); 173 | obj.CheckForError(); 174 | end 175 | function obj = set.Volts(obj, Value) 176 | calllib(obj.libname, 'ctx_GICSources_Set_Volts', obj.dssctx, Value); 177 | obj.CheckForError(); 178 | end 179 | end 180 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IISources.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IISources < DSS_MATLAB.Base 2 | % IISources: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all ISource names 6 | % Count - Number of ISource objects 7 | % First - Set first object of ISource; returns 0 if none. 8 | % Name - Get/sets the name of the current active ISource 9 | % Next - Sets next ISource active; returns 0 if no more. 10 | % idx - Sets next ISource active; returns 0 if no more. 11 | % Amps - Magnitude of the ISource in amps 12 | % AngleDeg - Phase angle for ISource, degrees 13 | % Frequency - The present frequency of the ISource, Hz 14 | 15 | properties 16 | AllNames 17 | Count 18 | First 19 | Name 20 | Next 21 | idx 22 | Amps 23 | AngleDeg 24 | Frequency 25 | end 26 | 27 | methods (Access = public) 28 | function obj = IISources(apiutil) 29 | obj@DSS_MATLAB.Base(apiutil); 30 | end 31 | 32 | end 33 | methods 34 | 35 | function result = get.AllNames(obj) 36 | % Array of strings with all ISource names 37 | result = obj.apiutil.get_string_array('ctx_ISources_Get_AllNames'); 38 | end 39 | 40 | function result = get.Count(obj) 41 | % Number of ISource objects 42 | result = calllib(obj.libname, 'ctx_ISources_Get_Count', obj.dssctx); 43 | end 44 | 45 | function result = get.First(obj) 46 | % Set first object of ISource; returns 0 if none. 47 | result = calllib(obj.libname, 'ctx_ISources_Get_First', obj.dssctx); 48 | end 49 | 50 | function result = get.Name(obj) 51 | % Get/sets the name of the current active ISource 52 | result = calllib(obj.libname, 'ctx_ISources_Get_Name', obj.dssctx); 53 | end 54 | function obj = set.Name(obj, Value) 55 | calllib(obj.libname, 'ctx_ISources_Set_Name', obj.dssctx, Value); 56 | obj.CheckForError(); 57 | end 58 | 59 | function result = get.Next(obj) 60 | % Sets next ISource active; returns 0 if no more. 61 | result = calllib(obj.libname, 'ctx_ISources_Get_Next', obj.dssctx); 62 | end 63 | 64 | function result = get.idx(obj) 65 | % Get/set active ISource by index; 1..Count 66 | result = calllib(obj.libname, 'ctx_ISources_Get_idx', obj.dssctx); 67 | end 68 | function obj = set.idx(obj, Value) 69 | calllib(obj.libname, 'ctx_ISources_Set_idx', obj.dssctx, Value); 70 | obj.CheckForError(); 71 | end 72 | 73 | 74 | function result = get.Amps(obj) 75 | % Magnitude of the ISource in amps 76 | result = calllib(obj.libname, 'ctx_ISources_Get_Amps', obj.dssctx); 77 | obj.CheckForError(); 78 | end 79 | function obj = set.Amps(obj, Value) 80 | calllib(obj.libname, 'ctx_ISources_Set_Amps', obj.dssctx, Value); 81 | obj.CheckForError(); 82 | end 83 | 84 | function result = get.AngleDeg(obj) 85 | % Phase angle for ISource, degrees 86 | result = calllib(obj.libname, 'ctx_ISources_Get_AngleDeg', obj.dssctx); 87 | obj.CheckForError(); 88 | end 89 | function obj = set.AngleDeg(obj, Value) 90 | calllib(obj.libname, 'ctx_ISources_Set_AngleDeg', obj.dssctx, Value); 91 | obj.CheckForError(); 92 | end 93 | 94 | function result = get.Frequency(obj) 95 | % The present frequency of the ISource, Hz 96 | result = calllib(obj.libname, 'ctx_ISources_Get_Frequency', obj.dssctx); 97 | obj.CheckForError(); 98 | end 99 | function obj = set.Frequency(obj, Value) 100 | calllib(obj.libname, 'ctx_ISources_Set_Frequency', obj.dssctx, Value); 101 | obj.CheckForError(); 102 | end 103 | end 104 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/ILineCodes.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) ILineCodes < DSS_MATLAB.Base 2 | % ILineCodes: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all LineCode names 6 | % Count - Number of LineCode objects 7 | % First - Set first object of LineCode; returns 0 if none. 8 | % Name - Get/sets the name of the current active LineCode 9 | % Next - Sets next LineCode active; returns 0 if no more. 10 | % idx - Sets next LineCode active; returns 0 if no more. 11 | % C0 - Zero-sequence capacitance, nF per unit length 12 | % C1 - Positive-sequence capacitance, nF per unit length 13 | % Cmatrix - Capacitance matrix, nF per unit length 14 | % EmergAmps - Emergency ampere rating 15 | % IsZ1Z0 - Flag denoting whether impedance data were entered in symmetrical components 16 | % NormAmps - Normal Ampere rating 17 | % Phases - Number of Phases 18 | % R0 - Zero-Sequence Resistance, ohms per unit length 19 | % R1 - Positive-sequence resistance ohms per unit length 20 | % Rmatrix - Resistance matrix, ohms per unit length 21 | % Units - 22 | % X0 - Zero Sequence Reactance, Ohms per unit length 23 | % X1 - Posiive-sequence reactance, ohms per unit length 24 | % Xmatrix - Reactance matrix, ohms per unit length 25 | 26 | properties 27 | AllNames 28 | Count 29 | First 30 | Name 31 | Next 32 | idx 33 | C0 34 | C1 35 | Cmatrix 36 | EmergAmps 37 | IsZ1Z0 38 | NormAmps 39 | Phases 40 | R0 41 | R1 42 | Rmatrix 43 | Units 44 | X0 45 | X1 46 | Xmatrix 47 | end 48 | 49 | methods (Access = public) 50 | function obj = ILineCodes(apiutil) 51 | obj@DSS_MATLAB.Base(apiutil); 52 | end 53 | 54 | end 55 | methods 56 | 57 | function result = get.AllNames(obj) 58 | % Array of strings with all LineCode names 59 | result = obj.apiutil.get_string_array('ctx_LineCodes_Get_AllNames'); 60 | end 61 | 62 | function result = get.Count(obj) 63 | % Number of LineCode objects 64 | result = calllib(obj.libname, 'ctx_LineCodes_Get_Count', obj.dssctx); 65 | end 66 | 67 | function result = get.First(obj) 68 | % Set first object of LineCode; returns 0 if none. 69 | result = calllib(obj.libname, 'ctx_LineCodes_Get_First', obj.dssctx); 70 | end 71 | 72 | function result = get.Name(obj) 73 | % Get/sets the name of the current active LineCode 74 | result = calllib(obj.libname, 'ctx_LineCodes_Get_Name', obj.dssctx); 75 | end 76 | function obj = set.Name(obj, Value) 77 | calllib(obj.libname, 'ctx_LineCodes_Set_Name', obj.dssctx, Value); 78 | obj.CheckForError(); 79 | end 80 | 81 | function result = get.Next(obj) 82 | % Sets next LineCode active; returns 0 if no more. 83 | result = calllib(obj.libname, 'ctx_LineCodes_Get_Next', obj.dssctx); 84 | end 85 | 86 | function result = get.idx(obj) 87 | % Get/set active LineCode by index; 1..Count 88 | result = calllib(obj.libname, 'ctx_LineCodes_Get_idx', obj.dssctx); 89 | end 90 | function obj = set.idx(obj, Value) 91 | calllib(obj.libname, 'ctx_LineCodes_Set_idx', obj.dssctx, Value); 92 | obj.CheckForError(); 93 | end 94 | 95 | 96 | function result = get.C0(obj) 97 | % Zero-sequence capacitance, nF per unit length 98 | result = calllib(obj.libname, 'ctx_LineCodes_Get_C0', obj.dssctx); 99 | obj.CheckForError(); 100 | end 101 | function obj = set.C0(obj, Value) 102 | calllib(obj.libname, 'ctx_LineCodes_Set_C0', obj.dssctx, Value); 103 | obj.CheckForError(); 104 | end 105 | 106 | function result = get.C1(obj) 107 | % Positive-sequence capacitance, nF per unit length 108 | result = calllib(obj.libname, 'ctx_LineCodes_Get_C1', obj.dssctx); 109 | obj.CheckForError(); 110 | end 111 | function obj = set.C1(obj, Value) 112 | calllib(obj.libname, 'ctx_LineCodes_Set_C1', obj.dssctx, Value); 113 | obj.CheckForError(); 114 | end 115 | 116 | function result = get.Cmatrix(obj) 117 | % Capacitance matrix, nF per unit length 118 | calllib(obj.libname, 'ctx_LineCodes_Get_Cmatrix_GR', obj.dssctx); 119 | obj.CheckForError(); 120 | result = obj.apiutil.get_float64_gr_array(); 121 | end 122 | function obj = set.Cmatrix(obj, Value) 123 | calllib(obj.libname, 'ctx_LineCodes_Set_Cmatrix', obj.dssctx, Value, numel(Value)); 124 | obj.CheckForError(); 125 | end 126 | 127 | function result = get.EmergAmps(obj) 128 | % Emergency ampere rating 129 | result = calllib(obj.libname, 'ctx_LineCodes_Get_EmergAmps', obj.dssctx); 130 | obj.CheckForError(); 131 | end 132 | function obj = set.EmergAmps(obj, Value) 133 | calllib(obj.libname, 'ctx_LineCodes_Set_EmergAmps', obj.dssctx, Value); 134 | obj.CheckForError(); 135 | end 136 | 137 | function result = get.IsZ1Z0(obj) 138 | % Flag denoting whether impedance data were entered in symmetrical components 139 | result = (calllib(obj.libname, 'ctx_LineCodes_Get_IsZ1Z0', obj.dssctx) ~= 0); 140 | obj.CheckForError(); 141 | end 142 | 143 | function result = get.NormAmps(obj) 144 | % Normal Ampere rating 145 | result = calllib(obj.libname, 'ctx_LineCodes_Get_NormAmps', obj.dssctx); 146 | obj.CheckForError(); 147 | end 148 | function obj = set.NormAmps(obj, Value) 149 | calllib(obj.libname, 'ctx_LineCodes_Set_NormAmps', obj.dssctx, Value); 150 | obj.CheckForError(); 151 | end 152 | 153 | function result = get.Phases(obj) 154 | % Number of Phases 155 | result = calllib(obj.libname, 'ctx_LineCodes_Get_Phases', obj.dssctx); 156 | obj.CheckForError(); 157 | end 158 | function obj = set.Phases(obj, Value) 159 | calllib(obj.libname, 'ctx_LineCodes_Set_Phases', obj.dssctx, Value); 160 | obj.CheckForError(); 161 | end 162 | 163 | function result = get.R0(obj) 164 | % Zero-Sequence Resistance, ohms per unit length 165 | result = calllib(obj.libname, 'ctx_LineCodes_Get_R0', obj.dssctx); 166 | obj.CheckForError(); 167 | end 168 | function obj = set.R0(obj, Value) 169 | calllib(obj.libname, 'ctx_LineCodes_Set_R0', obj.dssctx, Value); 170 | obj.CheckForError(); 171 | end 172 | 173 | function result = get.R1(obj) 174 | % Positive-sequence resistance ohms per unit length 175 | result = calllib(obj.libname, 'ctx_LineCodes_Get_R1', obj.dssctx); 176 | obj.CheckForError(); 177 | end 178 | function obj = set.R1(obj, Value) 179 | calllib(obj.libname, 'ctx_LineCodes_Set_R1', obj.dssctx, Value); 180 | obj.CheckForError(); 181 | end 182 | 183 | function result = get.Rmatrix(obj) 184 | % Resistance matrix, ohms per unit length 185 | calllib(obj.libname, 'ctx_LineCodes_Get_Rmatrix_GR', obj.dssctx); 186 | obj.CheckForError(); 187 | result = obj.apiutil.get_float64_gr_array(); 188 | end 189 | function obj = set.Rmatrix(obj, Value) 190 | calllib(obj.libname, 'ctx_LineCodes_Set_Rmatrix', obj.dssctx, Value, numel(Value)); 191 | obj.CheckForError(); 192 | end 193 | 194 | function result = get.Units(obj) 195 | result = DSS_MATLAB.LineUnits(calllib(obj.libname, 'ctx_LineCodes_Get_Units', obj.dssctx)); 196 | obj.CheckForError(); 197 | end 198 | function obj = set.Units(obj, Value) 199 | calllib(obj.libname, 'ctx_LineCodes_Set_Units', obj.dssctx, Value); 200 | obj.CheckForError(); 201 | end 202 | 203 | function result = get.X0(obj) 204 | % Zero Sequence Reactance, Ohms per unit length 205 | result = calllib(obj.libname, 'ctx_LineCodes_Get_X0', obj.dssctx); 206 | obj.CheckForError(); 207 | end 208 | function obj = set.X0(obj, Value) 209 | calllib(obj.libname, 'ctx_LineCodes_Set_X0', obj.dssctx, Value); 210 | obj.CheckForError(); 211 | end 212 | 213 | function result = get.X1(obj) 214 | % Posiive-sequence reactance, ohms per unit length 215 | result = calllib(obj.libname, 'ctx_LineCodes_Get_X1', obj.dssctx); 216 | obj.CheckForError(); 217 | end 218 | function obj = set.X1(obj, Value) 219 | calllib(obj.libname, 'ctx_LineCodes_Set_X1', obj.dssctx, Value); 220 | obj.CheckForError(); 221 | end 222 | 223 | function result = get.Xmatrix(obj) 224 | % Reactance matrix, ohms per unit length 225 | calllib(obj.libname, 'ctx_LineCodes_Get_Xmatrix_GR', obj.dssctx); 226 | obj.CheckForError(); 227 | result = obj.apiutil.get_float64_gr_array(); 228 | end 229 | function obj = set.Xmatrix(obj, Value) 230 | calllib(obj.libname, 'ctx_LineCodes_Set_Xmatrix', obj.dssctx, Value, numel(Value)); 231 | obj.CheckForError(); 232 | end 233 | end 234 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/ILineGeometries.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) ILineGeometries < DSS_MATLAB.Base 2 | % ILineGeometries: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all LineGeometrie names 6 | % Count - Number of LineGeometrie objects 7 | % First - Set first object of LineGeometrie; returns 0 if none. 8 | % Name - Get/sets the name of the current active LineGeometrie 9 | % Next - Sets next LineGeometrie active; returns 0 if no more. 10 | % idx - Sets next LineGeometrie active; returns 0 if no more. 11 | % Conductors - Array of strings with names of all conductors in the active LineGeometry object 12 | % EmergAmps - Emergency ampere rating 13 | % NormAmps - Normal ampere rating 14 | % RhoEarth - 15 | % Reduce - 16 | % Phases - Number of Phases 17 | % Units - 18 | % Xcoords - Get/Set the X (horizontal) coordinates of the conductors 19 | % Ycoords - Get/Set the Y (vertical/height) coordinates of the conductors 20 | % Nconds - Number of conductors in this geometry. Default is 3. Triggers memory allocations. Define first! 21 | % 22 | % Methods: 23 | % Rmatrix - Resistance matrix, ohms 24 | % Xmatrix - Reactance matrix, ohms 25 | % Zmatrix - Complex impedance matrix, ohms 26 | % Cmatrix - Capacitance matrix, nF 27 | 28 | properties 29 | AllNames 30 | Count 31 | First 32 | Name 33 | Next 34 | idx 35 | Conductors 36 | EmergAmps 37 | NormAmps 38 | RhoEarth 39 | Reduce 40 | Phases 41 | Units 42 | Xcoords 43 | Ycoords 44 | Nconds 45 | end 46 | 47 | methods (Access = public) 48 | function obj = ILineGeometries(apiutil) 49 | obj@DSS_MATLAB.Base(apiutil); 50 | end 51 | 52 | function result = Rmatrix(obj, Frequency, Length, Units) 53 | % Resistance matrix, ohms 54 | calllib(obj.libname, 'ctx_LineGeometries_Get_Rmatrix_GR', obj.dssctx, Frequency, Length, Units); 55 | obj.CheckForError(); 56 | result = obj.apiutil.get_float64_gr_array(); 57 | end 58 | 59 | function result = Xmatrix(obj, Frequency, Length, Units) 60 | % Reactance matrix, ohms 61 | calllib(obj.libname, 'ctx_LineGeometries_Get_Xmatrix_GR', obj.dssctx, Frequency, Length, Units); 62 | obj.CheckForError(); 63 | result = obj.apiutil.get_float64_gr_array(); 64 | end 65 | 66 | function result = Zmatrix(obj, Frequency, Length, Units) 67 | % Complex impedance matrix, ohms 68 | calllib(obj.libname, 'ctx_LineGeometries_Get_Zmatrix_GR', obj.dssctx, Frequency, Length, Units); 69 | obj.CheckForError(); 70 | result = obj.apiutil.get_complex128_gr_array(); 71 | end 72 | 73 | function result = Cmatrix(obj, Frequency, Length, Units) 74 | % Capacitance matrix, nF 75 | calllib(obj.libname, 'ctx_LineGeometries_Get_Cmatrix_GR', obj.dssctx, Frequency, Length, Units); 76 | obj.CheckForError(); 77 | result = obj.apiutil.get_float64_gr_array(); 78 | end 79 | 80 | end 81 | methods 82 | 83 | function result = get.AllNames(obj) 84 | % Array of strings with all LineGeometrie names 85 | result = obj.apiutil.get_string_array('ctx_LineGeometries_Get_AllNames'); 86 | end 87 | 88 | function result = get.Count(obj) 89 | % Number of LineGeometrie objects 90 | result = calllib(obj.libname, 'ctx_LineGeometries_Get_Count', obj.dssctx); 91 | end 92 | 93 | function result = get.First(obj) 94 | % Set first object of LineGeometrie; returns 0 if none. 95 | result = calllib(obj.libname, 'ctx_LineGeometries_Get_First', obj.dssctx); 96 | end 97 | 98 | function result = get.Name(obj) 99 | % Get/sets the name of the current active LineGeometrie 100 | result = calllib(obj.libname, 'ctx_LineGeometries_Get_Name', obj.dssctx); 101 | end 102 | function obj = set.Name(obj, Value) 103 | calllib(obj.libname, 'ctx_LineGeometries_Set_Name', obj.dssctx, Value); 104 | obj.CheckForError(); 105 | end 106 | 107 | function result = get.Next(obj) 108 | % Sets next LineGeometrie active; returns 0 if no more. 109 | result = calllib(obj.libname, 'ctx_LineGeometries_Get_Next', obj.dssctx); 110 | end 111 | 112 | function result = get.idx(obj) 113 | % Get/set active LineGeometrie by index; 1..Count 114 | result = calllib(obj.libname, 'ctx_LineGeometries_Get_idx', obj.dssctx); 115 | end 116 | function obj = set.idx(obj, Value) 117 | calllib(obj.libname, 'ctx_LineGeometries_Set_idx', obj.dssctx, Value); 118 | obj.CheckForError(); 119 | end 120 | 121 | 122 | function result = get.Conductors(obj) 123 | % Array of strings with names of all conductors in the active LineGeometry object 124 | result = obj.apiutil.get_string_array('ctx_LineGeometries_Get_Conductors'); 125 | obj.CheckForError(); 126 | end 127 | 128 | function result = get.EmergAmps(obj) 129 | % Emergency ampere rating 130 | result = calllib(obj.libname, 'ctx_LineGeometries_Get_EmergAmps', obj.dssctx); 131 | obj.CheckForError(); 132 | end 133 | function obj = set.EmergAmps(obj, Value) 134 | calllib(obj.libname, 'ctx_LineGeometries_Set_EmergAmps', obj.dssctx, Value); 135 | obj.CheckForError(); 136 | end 137 | 138 | function result = get.NormAmps(obj) 139 | % Normal ampere rating 140 | result = calllib(obj.libname, 'ctx_LineGeometries_Get_NormAmps', obj.dssctx); 141 | obj.CheckForError(); 142 | end 143 | function obj = set.NormAmps(obj, Value) 144 | calllib(obj.libname, 'ctx_LineGeometries_Set_NormAmps', obj.dssctx, Value); 145 | obj.CheckForError(); 146 | end 147 | 148 | function result = get.RhoEarth(obj) 149 | result = calllib(obj.libname, 'ctx_LineGeometries_Get_RhoEarth', obj.dssctx); 150 | obj.CheckForError(); 151 | end 152 | function obj = set.RhoEarth(obj, Value) 153 | calllib(obj.libname, 'ctx_LineGeometries_Set_RhoEarth', obj.dssctx, Value); 154 | obj.CheckForError(); 155 | end 156 | 157 | function result = get.Reduce(obj) 158 | result = (calllib(obj.libname, 'ctx_LineGeometries_Get_Reduce', obj.dssctx) ~= 0); 159 | obj.CheckForError(); 160 | end 161 | function obj = set.Reduce(obj, Value) 162 | calllib(obj.libname, 'ctx_LineGeometries_Set_Reduce', obj.dssctx, Value); 163 | obj.CheckForError(); 164 | end 165 | 166 | function result = get.Phases(obj) 167 | % Number of Phases 168 | result = calllib(obj.libname, 'ctx_LineGeometries_Get_Phases', obj.dssctx); 169 | obj.CheckForError(); 170 | end 171 | function obj = set.Phases(obj, Value) 172 | calllib(obj.libname, 'ctx_LineGeometries_Set_Phases', obj.dssctx, Value); 173 | obj.CheckForError(); 174 | end 175 | 176 | function result = get.Units(obj) 177 | calllib(obj.libname, 'ctx_LineGeometries_Get_Units_GR', obj.dssctx); 178 | obj.CheckForError(); 179 | result = DSS_MATLAB.LineUnits(obj.apiutil.get_int32_gr_array()) 180 | end 181 | function obj = set.Units(obj, Value) 182 | calllib(obj.libname, 'ctx_LineGeometries_Set_Units', obj.dssctx, Value, numel(Value)); 183 | obj.CheckForError(); 184 | end 185 | 186 | function result = get.Xcoords(obj) 187 | % Get/Set the X (horizontal) coordinates of the conductors 188 | calllib(obj.libname, 'ctx_LineGeometries_Get_Xcoords_GR', obj.dssctx); 189 | obj.CheckForError(); 190 | result = obj.apiutil.get_float64_gr_array(); 191 | end 192 | function obj = set.Xcoords(obj, Value) 193 | calllib(obj.libname, 'ctx_LineGeometries_Set_Xcoords', obj.dssctx, Value, numel(Value)); 194 | obj.CheckForError(); 195 | end 196 | 197 | function result = get.Ycoords(obj) 198 | % Get/Set the Y (vertical/height) coordinates of the conductors 199 | calllib(obj.libname, 'ctx_LineGeometries_Get_Ycoords_GR', obj.dssctx); 200 | obj.CheckForError(); 201 | result = obj.apiutil.get_float64_gr_array(); 202 | end 203 | function obj = set.Ycoords(obj, Value) 204 | calllib(obj.libname, 'ctx_LineGeometries_Set_Ycoords', obj.dssctx, Value, numel(Value)); 205 | obj.CheckForError(); 206 | end 207 | 208 | function result = get.Nconds(obj) 209 | % Number of conductors in this geometry. Default is 3. Triggers memory allocations. Define first! 210 | result = calllib(obj.libname, 'ctx_LineGeometries_Get_Nconds', obj.dssctx); 211 | obj.CheckForError(); 212 | end 213 | function obj = set.Nconds(obj, Value) 214 | calllib(obj.libname, 'ctx_LineGeometries_Set_Nconds', obj.dssctx, Value); 215 | obj.CheckForError(); 216 | end 217 | end 218 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/ILineSpacings.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) ILineSpacings < DSS_MATLAB.Base 2 | % ILineSpacings: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all LineSpacing names 6 | % Count - Number of LineSpacing objects 7 | % First - Set first object of LineSpacing; returns 0 if none. 8 | % Name - Get/sets the name of the current active LineSpacing 9 | % Next - Sets next LineSpacing active; returns 0 if no more. 10 | % idx - Sets next LineSpacing active; returns 0 if no more. 11 | % Phases - Number of Phases 12 | % Nconds - 13 | % Units - 14 | % Xcoords - Get/Set the X (horizontal) coordinates of the conductors 15 | % Ycoords - Get/Set the Y (vertical/height) coordinates of the conductors 16 | 17 | properties 18 | AllNames 19 | Count 20 | First 21 | Name 22 | Next 23 | idx 24 | Phases 25 | Nconds 26 | Units 27 | Xcoords 28 | Ycoords 29 | end 30 | 31 | methods (Access = public) 32 | function obj = ILineSpacings(apiutil) 33 | obj@DSS_MATLAB.Base(apiutil); 34 | end 35 | 36 | end 37 | methods 38 | 39 | function result = get.AllNames(obj) 40 | % Array of strings with all LineSpacing names 41 | result = obj.apiutil.get_string_array('ctx_LineSpacings_Get_AllNames'); 42 | end 43 | 44 | function result = get.Count(obj) 45 | % Number of LineSpacing objects 46 | result = calllib(obj.libname, 'ctx_LineSpacings_Get_Count', obj.dssctx); 47 | end 48 | 49 | function result = get.First(obj) 50 | % Set first object of LineSpacing; returns 0 if none. 51 | result = calllib(obj.libname, 'ctx_LineSpacings_Get_First', obj.dssctx); 52 | end 53 | 54 | function result = get.Name(obj) 55 | % Get/sets the name of the current active LineSpacing 56 | result = calllib(obj.libname, 'ctx_LineSpacings_Get_Name', obj.dssctx); 57 | end 58 | function obj = set.Name(obj, Value) 59 | calllib(obj.libname, 'ctx_LineSpacings_Set_Name', obj.dssctx, Value); 60 | obj.CheckForError(); 61 | end 62 | 63 | function result = get.Next(obj) 64 | % Sets next LineSpacing active; returns 0 if no more. 65 | result = calllib(obj.libname, 'ctx_LineSpacings_Get_Next', obj.dssctx); 66 | end 67 | 68 | function result = get.idx(obj) 69 | % Get/set active LineSpacing by index; 1..Count 70 | result = calllib(obj.libname, 'ctx_LineSpacings_Get_idx', obj.dssctx); 71 | end 72 | function obj = set.idx(obj, Value) 73 | calllib(obj.libname, 'ctx_LineSpacings_Set_idx', obj.dssctx, Value); 74 | obj.CheckForError(); 75 | end 76 | 77 | 78 | function result = get.Phases(obj) 79 | % Number of Phases 80 | result = calllib(obj.libname, 'ctx_LineSpacings_Get_Phases', obj.dssctx); 81 | obj.CheckForError(); 82 | end 83 | function obj = set.Phases(obj, Value) 84 | calllib(obj.libname, 'ctx_LineSpacings_Set_Phases', obj.dssctx, Value); 85 | obj.CheckForError(); 86 | end 87 | 88 | function result = get.Nconds(obj) 89 | result = calllib(obj.libname, 'ctx_LineSpacings_Get_Nconds', obj.dssctx); 90 | obj.CheckForError(); 91 | end 92 | function obj = set.Nconds(obj, Value) 93 | calllib(obj.libname, 'ctx_LineSpacings_Set_Nconds', obj.dssctx, Value); 94 | obj.CheckForError(); 95 | end 96 | 97 | function result = get.Units(obj) 98 | result = DSS_MATLAB.LineUnits(calllib(obj.libname, 'ctx_LineSpacings_Get_Units', obj.dssctx)); 99 | obj.CheckForError(); 100 | end 101 | function obj = set.Units(obj, Value) 102 | calllib(obj.libname, 'ctx_LineSpacings_Set_Units', obj.dssctx, Value); 103 | obj.CheckForError(); 104 | end 105 | 106 | function result = get.Xcoords(obj) 107 | % Get/Set the X (horizontal) coordinates of the conductors 108 | calllib(obj.libname, 'ctx_LineSpacings_Get_Xcoords_GR', obj.dssctx); 109 | obj.CheckForError(); 110 | result = obj.apiutil.get_float64_gr_array(); 111 | end 112 | function obj = set.Xcoords(obj, Value) 113 | calllib(obj.libname, 'ctx_LineSpacings_Set_Xcoords', obj.dssctx, Value, numel(Value)); 114 | obj.CheckForError(); 115 | end 116 | 117 | function result = get.Ycoords(obj) 118 | % Get/Set the Y (vertical/height) coordinates of the conductors 119 | calllib(obj.libname, 'ctx_LineSpacings_Get_Ycoords_GR', obj.dssctx); 120 | obj.CheckForError(); 121 | result = obj.apiutil.get_float64_gr_array(); 122 | end 123 | function obj = set.Ycoords(obj, Value) 124 | calllib(obj.libname, 'ctx_LineSpacings_Set_Ycoords', obj.dssctx, Value, numel(Value)); 125 | obj.CheckForError(); 126 | end 127 | end 128 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/ILoadShapes.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) ILoadShapes < DSS_MATLAB.Base 2 | % ILoadShapes: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all LoadShape names 6 | % Count - Number of LoadShape objects 7 | % First - Set first object of LoadShape; returns 0 if none. 8 | % Name - Get/sets the name of the current active LoadShape 9 | % Next - Sets next LoadShape active; returns 0 if no more. 10 | % idx - Sets next LoadShape active; returns 0 if no more. 11 | % HrInterval - Fixed interval time value, hours. 12 | % MinInterval - Fixed Interval time value, in minutes 13 | % Npts - Get/set Number of points in active Loadshape. 14 | % PBase - 15 | % Pmult - Array of doubles for the P multiplier in the Loadshape. 16 | % QBase - Base for normalizing Q curve. If left at zero, the peak value is used. 17 | % Qmult - Array of doubles containing the Q multipliers. 18 | % TimeArray - Time array in hours correscponding to P and Q multipliers when the Interval=0. 19 | % UseActual - Boolean flag to let Loads know to use the actual value in the curve rather than use the value as a multiplier. 20 | % sInterval - 21 | % 22 | % Methods: 23 | % New - 24 | % Normalize - 25 | 26 | properties 27 | AllNames 28 | Count 29 | First 30 | Name 31 | Next 32 | idx 33 | HrInterval 34 | MinInterval 35 | Npts 36 | PBase 37 | Pmult 38 | QBase 39 | Qmult 40 | TimeArray 41 | UseActual 42 | sInterval 43 | end 44 | 45 | methods (Access = public) 46 | function obj = ILoadShapes(apiutil) 47 | obj@DSS_MATLAB.Base(apiutil); 48 | end 49 | 50 | function result = New(obj, Name) 51 | result = calllib(obj.libname, 'ctx_LoadShapes_New', obj.dssctx, Name); 52 | obj.CheckForError(); 53 | end 54 | 55 | function obj = Normalize(obj) 56 | calllib(obj.libname, 'ctx_LoadShapes_Normalize', obj.dssctx); 57 | obj.CheckForError(); 58 | end 59 | 60 | end 61 | methods 62 | 63 | function result = get.AllNames(obj) 64 | % Array of strings with all LoadShape names 65 | result = obj.apiutil.get_string_array('ctx_LoadShapes_Get_AllNames'); 66 | end 67 | 68 | function result = get.Count(obj) 69 | % Number of LoadShape objects 70 | result = calllib(obj.libname, 'ctx_LoadShapes_Get_Count', obj.dssctx); 71 | end 72 | 73 | function result = get.First(obj) 74 | % Set first object of LoadShape; returns 0 if none. 75 | result = calllib(obj.libname, 'ctx_LoadShapes_Get_First', obj.dssctx); 76 | end 77 | 78 | function result = get.Name(obj) 79 | % Get/sets the name of the current active LoadShape 80 | result = calllib(obj.libname, 'ctx_LoadShapes_Get_Name', obj.dssctx); 81 | end 82 | function obj = set.Name(obj, Value) 83 | calllib(obj.libname, 'ctx_LoadShapes_Set_Name', obj.dssctx, Value); 84 | obj.CheckForError(); 85 | end 86 | 87 | function result = get.Next(obj) 88 | % Sets next LoadShape active; returns 0 if no more. 89 | result = calllib(obj.libname, 'ctx_LoadShapes_Get_Next', obj.dssctx); 90 | end 91 | 92 | function result = get.idx(obj) 93 | % Get/set active LoadShape by index; 1..Count 94 | result = calllib(obj.libname, 'ctx_LoadShapes_Get_idx', obj.dssctx); 95 | end 96 | function obj = set.idx(obj, Value) 97 | calllib(obj.libname, 'ctx_LoadShapes_Set_idx', obj.dssctx, Value); 98 | obj.CheckForError(); 99 | end 100 | 101 | 102 | function result = get.HrInterval(obj) 103 | % Fixed interval time value, hours. 104 | result = calllib(obj.libname, 'ctx_LoadShapes_Get_HrInterval', obj.dssctx); 105 | obj.CheckForError(); 106 | end 107 | function obj = set.HrInterval(obj, Value) 108 | calllib(obj.libname, 'ctx_LoadShapes_Set_HrInterval', obj.dssctx, Value); 109 | obj.CheckForError(); 110 | end 111 | 112 | function result = get.MinInterval(obj) 113 | % Fixed Interval time value, in minutes 114 | result = calllib(obj.libname, 'ctx_LoadShapes_Get_MinInterval', obj.dssctx); 115 | obj.CheckForError(); 116 | end 117 | function obj = set.MinInterval(obj, Value) 118 | calllib(obj.libname, 'ctx_LoadShapes_Set_MinInterval', obj.dssctx, Value); 119 | obj.CheckForError(); 120 | end 121 | 122 | function result = get.Npts(obj) 123 | % Get/set Number of points in active Loadshape. 124 | result = calllib(obj.libname, 'ctx_LoadShapes_Get_Npts', obj.dssctx); 125 | obj.CheckForError(); 126 | end 127 | function obj = set.Npts(obj, Value) 128 | calllib(obj.libname, 'ctx_LoadShapes_Set_Npts', obj.dssctx, Value); 129 | obj.CheckForError(); 130 | end 131 | 132 | function result = get.PBase(obj) 133 | result = calllib(obj.libname, 'ctx_LoadShapes_Get_PBase', obj.dssctx); 134 | obj.CheckForError(); 135 | end 136 | function obj = set.PBase(obj, Value) 137 | calllib(obj.libname, 'ctx_LoadShapes_Set_PBase', obj.dssctx, Value); 138 | obj.CheckForError(); 139 | end 140 | 141 | function result = get.Pmult(obj) 142 | % Array of doubles for the P multiplier in the Loadshape. 143 | calllib(obj.libname, 'ctx_LoadShapes_Get_Pmult_GR', obj.dssctx); 144 | obj.CheckForError(); 145 | result = obj.apiutil.get_float64_gr_array(); 146 | end 147 | function obj = set.Pmult(obj, Value) 148 | calllib(obj.libname, 'ctx_LoadShapes_Set_Pmult', obj.dssctx, Value, numel(Value)); 149 | obj.CheckForError(); 150 | end 151 | 152 | function result = get.QBase(obj) 153 | % Base for normalizing Q curve. If left at zero, the peak value is used. 154 | result = calllib(obj.libname, 'ctx_LoadShapes_Get_Qbase', obj.dssctx); 155 | obj.CheckForError(); 156 | end 157 | function obj = set.QBase(obj, Value) 158 | calllib(obj.libname, 'ctx_LoadShapes_Set_Qbase', obj.dssctx, Value); 159 | obj.CheckForError(); 160 | end 161 | 162 | function result = get.Qmult(obj) 163 | % Array of doubles containing the Q multipliers. 164 | calllib(obj.libname, 'ctx_LoadShapes_Get_Qmult_GR', obj.dssctx); 165 | obj.CheckForError(); 166 | result = obj.apiutil.get_float64_gr_array(); 167 | end 168 | function obj = set.Qmult(obj, Value) 169 | calllib(obj.libname, 'ctx_LoadShapes_Set_Qmult', obj.dssctx, Value, numel(Value)); 170 | obj.CheckForError(); 171 | end 172 | 173 | function result = get.TimeArray(obj) 174 | % Time array in hours correscponding to P and Q multipliers when the Interval=0. 175 | calllib(obj.libname, 'ctx_LoadShapes_Get_TimeArray_GR', obj.dssctx); 176 | obj.CheckForError(); 177 | result = obj.apiutil.get_float64_gr_array(); 178 | end 179 | function obj = set.TimeArray(obj, Value) 180 | calllib(obj.libname, 'ctx_LoadShapes_Set_TimeArray', obj.dssctx, Value, numel(Value)); 181 | obj.CheckForError(); 182 | end 183 | 184 | function result = get.UseActual(obj) 185 | % Boolean flag to let Loads know to use the actual value in the curve rather than use the value as a multiplier. 186 | result = (calllib(obj.libname, 'ctx_LoadShapes_Get_UseActual', obj.dssctx) ~= 0); 187 | obj.CheckForError(); 188 | end 189 | function obj = set.UseActual(obj, Value) 190 | calllib(obj.libname, 'ctx_LoadShapes_Set_UseActual', obj.dssctx, Value); 191 | obj.CheckForError(); 192 | end 193 | 194 | function result = get.sInterval(obj) 195 | result = calllib(obj.libname, 'ctx_LoadShapes_Get_SInterval', obj.dssctx); 196 | obj.CheckForError(); 197 | end 198 | function obj = set.sInterval(obj, Value) 199 | calllib(obj.libname, 'ctx_LoadShapes_Set_SInterval', obj.dssctx, Value); 200 | obj.CheckForError(); 201 | end 202 | end 203 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IParallel.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IParallel < DSS_MATLAB.Base 2 | % IParallel: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % ActiveActor - Gets/sets the ID of the Active Actor 6 | % ActiveParallel - (read) Sets ON/OFF (1/0) Parallel features of the Engine (write) Delivers if the Parallel features of the Engine are Active 7 | % ActorCPU - Gets/sets the CPU of the Active Actor 8 | % ActorProgress - Gets the progress of all existing actors in pct 9 | % ActorStatus - Gets the status of each actor 10 | % ConcatenateReports - (read) Reads the values of the ConcatenateReports option (1=enabled, 0=disabled) (write) Enable/Disable (1/0) the ConcatenateReports option for extracting monitors data 11 | % NumCPUs - Delivers the number of CPUs on the current PC 12 | % NumCores - Delivers the number of Cores of the local PC 13 | % NumOfActors - Gets the number of Actors created 14 | % 15 | % Methods: 16 | % CreateActor - 17 | % Wait - 18 | 19 | properties 20 | ActiveActor 21 | ActiveParallel 22 | ActorCPU 23 | ActorProgress 24 | ActorStatus 25 | ConcatenateReports 26 | NumCPUs 27 | NumCores 28 | NumOfActors 29 | end 30 | 31 | methods (Access = public) 32 | function obj = IParallel(apiutil) 33 | obj@DSS_MATLAB.Base(apiutil); 34 | end 35 | 36 | function obj = CreateActor(obj) 37 | calllib(obj.libname, 'ctx_Parallel_CreateActor', obj.dssctx); 38 | obj.CheckForError(); 39 | end 40 | 41 | function obj = Wait(obj) 42 | calllib(obj.libname, 'ctx_Parallel_Wait', obj.dssctx); 43 | obj.CheckForError(); 44 | end 45 | 46 | end 47 | methods 48 | 49 | function result = get.ActiveActor(obj) 50 | % Gets/sets the ID of the Active Actor 51 | result = calllib(obj.libname, 'ctx_Parallel_Get_ActiveActor', obj.dssctx); 52 | obj.CheckForError(); 53 | end 54 | function obj = set.ActiveActor(obj, Value) 55 | calllib(obj.libname, 'ctx_Parallel_Set_ActiveActor', obj.dssctx, Value); 56 | obj.CheckForError(); 57 | end 58 | 59 | function result = get.ActiveParallel(obj) 60 | % (read) Sets ON/OFF (1/0) Parallel features of the Engine 61 | % (write) Delivers if the Parallel features of the Engine are Active 62 | result = calllib(obj.libname, 'ctx_Parallel_Get_ActiveParallel', obj.dssctx); 63 | obj.CheckForError(); 64 | end 65 | function obj = set.ActiveParallel(obj, Value) 66 | calllib(obj.libname, 'ctx_Parallel_Set_ActiveParallel', obj.dssctx, Value); 67 | obj.CheckForError(); 68 | end 69 | 70 | function result = get.ActorCPU(obj) 71 | % Gets/sets the CPU of the Active Actor 72 | result = calllib(obj.libname, 'ctx_Parallel_Get_ActorCPU', obj.dssctx); 73 | obj.CheckForError(); 74 | end 75 | function obj = set.ActorCPU(obj, Value) 76 | calllib(obj.libname, 'ctx_Parallel_Set_ActorCPU', obj.dssctx, Value); 77 | obj.CheckForError(); 78 | end 79 | 80 | function result = get.ActorProgress(obj) 81 | % Gets the progress of all existing actors in pct 82 | calllib(obj.libname, 'ctx_Parallel_Get_ActorProgress_GR', obj.dssctx); 83 | obj.CheckForError(); 84 | result = obj.apiutil.get_int32_gr_array(); 85 | end 86 | 87 | function result = get.ActorStatus(obj) 88 | % Gets the status of each actor 89 | calllib(obj.libname, 'ctx_Parallel_Get_ActorStatus_GR', obj.dssctx); 90 | obj.CheckForError(); 91 | result = obj.apiutil.get_int32_gr_array(); 92 | end 93 | 94 | function result = get.ConcatenateReports(obj) 95 | % (read) Reads the values of the ConcatenateReports option (1=enabled, 0=disabled) 96 | % (write) Enable/Disable (1/0) the ConcatenateReports option for extracting monitors data 97 | result = calllib(obj.libname, 'ctx_Parallel_Get_ConcatenateReports', obj.dssctx); 98 | obj.CheckForError(); 99 | end 100 | function obj = set.ConcatenateReports(obj, Value) 101 | calllib(obj.libname, 'ctx_Parallel_Set_ConcatenateReports', obj.dssctx, Value); 102 | obj.CheckForError(); 103 | end 104 | 105 | function result = get.NumCPUs(obj) 106 | % Delivers the number of CPUs on the current PC 107 | result = calllib(obj.libname, 'ctx_Parallel_Get_NumCPUs', obj.dssctx); 108 | obj.CheckForError(); 109 | end 110 | 111 | function result = get.NumCores(obj) 112 | % Delivers the number of Cores of the local PC 113 | result = calllib(obj.libname, 'ctx_Parallel_Get_NumCores', obj.dssctx); 114 | obj.CheckForError(); 115 | end 116 | 117 | function result = get.NumOfActors(obj) 118 | % Gets the number of Actors created 119 | result = calllib(obj.libname, 'ctx_Parallel_Get_NumOfActors', obj.dssctx); 120 | obj.CheckForError(); 121 | end 122 | end 123 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IParser.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IParser < DSS_MATLAB.Base 2 | % IParser: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AutoIncrement - Default is FALSE. If TRUE parser automatically advances to next token after DblValue, IntValue, or StrValue. Simpler when you don't need to check for parameter names. 6 | % BeginQuote - Get/Set String containing the the characters for Quoting in OpenDSS scripts. Matching pairs defined in EndQuote. Default is "'([{. 7 | % CmdString - String to be parsed. Loading this string resets the Parser to the beginning of the line. Then parse off the tokens in sequence. 8 | % DblValue - Return next parameter as a double. 9 | % Delimiters - String defining hard delimiters used to separate token on the command string. Default is , and =. The = separates token name from token value. These override whitesspace to separate tokens. 10 | % EndQuote - String containing characters, in order, that match the beginning quote characters in BeginQuote. Default is "')]} 11 | % IntValue - Return next parameter as a long integer. 12 | % NextParam - Get next token and return tag name (before = sign) if any. See AutoIncrement. 13 | % StrValue - Return next parameter as a string 14 | % WhiteSpace - Get/set the characters used for White space in the command string. Default is blank and Tab. 15 | % 16 | % Methods: 17 | % Matrix - Use this property to parse a Matrix token in OpenDSS format. Returns square matrix of order specified. Order same as default Fortran order: column by column. 18 | % SymMatrix - Use this property to parse a matrix token specified in lower triangle form. Symmetry is forced. 19 | % Vector - Returns token as array of doubles. For parsing quoted array syntax. 20 | % ResetDelimiters - 21 | 22 | properties 23 | AutoIncrement 24 | BeginQuote 25 | CmdString 26 | DblValue 27 | Delimiters 28 | EndQuote 29 | IntValue 30 | NextParam 31 | StrValue 32 | WhiteSpace 33 | end 34 | 35 | methods (Access = public) 36 | function obj = IParser(apiutil) 37 | obj@DSS_MATLAB.Base(apiutil); 38 | end 39 | 40 | function result = Matrix(obj, ExpectedOrder) 41 | % Use this property to parse a Matrix token in OpenDSS format. Returns square matrix of order specified. Order same as default Fortran order: column by column. 42 | calllib(obj.libname, 'ctx_Parser_Get_Matrix_GR', obj.dssctx, ExpectedOrder); 43 | obj.CheckForError(); 44 | result = obj.apiutil.get_float64_gr_array(); 45 | end 46 | 47 | function result = SymMatrix(obj, ExpectedOrder) 48 | % Use this property to parse a matrix token specified in lower triangle form. Symmetry is forced. 49 | calllib(obj.libname, 'ctx_Parser_Get_SymMatrix_GR', obj.dssctx, ExpectedOrder); 50 | obj.CheckForError(); 51 | result = obj.apiutil.get_float64_gr_array(); 52 | end 53 | 54 | function result = Vector(obj, ExpectedSize) 55 | % Returns token as array of doubles. For parsing quoted array syntax. 56 | calllib(obj.libname, 'ctx_Parser_Get_Vector_GR', obj.dssctx, ExpectedSize); 57 | obj.CheckForError(); 58 | result = obj.apiutil.get_float64_gr_array(); 59 | end 60 | 61 | function obj = ResetDelimiters(obj) 62 | calllib(obj.libname, 'ctx_Parser_ResetDelimiters', obj.dssctx); 63 | obj.CheckForError(); 64 | end 65 | 66 | end 67 | methods 68 | 69 | function result = get.AutoIncrement(obj) 70 | % Default is FALSE. If TRUE parser automatically advances to next token after DblValue, IntValue, or StrValue. Simpler when you don't need to check for parameter names. 71 | result = (calllib(obj.libname, 'ctx_Parser_Get_AutoIncrement', obj.dssctx) ~= 0); 72 | obj.CheckForError(); 73 | end 74 | function obj = set.AutoIncrement(obj, Value) 75 | calllib(obj.libname, 'ctx_Parser_Set_AutoIncrement', obj.dssctx, Value); 76 | obj.CheckForError(); 77 | end 78 | 79 | function result = get.BeginQuote(obj) 80 | % Get/Set String containing the the characters for Quoting in OpenDSS scripts. Matching pairs defined in EndQuote. Default is "'([{. 81 | result = calllib(obj.libname, 'ctx_Parser_Get_BeginQuote', obj.dssctx); 82 | obj.CheckForError(); 83 | end 84 | function obj = set.BeginQuote(obj, Value) 85 | calllib(obj.libname, 'ctx_Parser_Set_BeginQuote', obj.dssctx, Value); 86 | obj.CheckForError(); 87 | end 88 | 89 | function result = get.CmdString(obj) 90 | % String to be parsed. Loading this string resets the Parser to the beginning of the line. Then parse off the tokens in sequence. 91 | result = calllib(obj.libname, 'ctx_Parser_Get_CmdString', obj.dssctx); 92 | obj.CheckForError(); 93 | end 94 | function obj = set.CmdString(obj, Value) 95 | calllib(obj.libname, 'ctx_Parser_Set_CmdString', obj.dssctx, Value); 96 | obj.CheckForError(); 97 | end 98 | 99 | function result = get.DblValue(obj) 100 | % Return next parameter as a double. 101 | result = calllib(obj.libname, 'ctx_Parser_Get_DblValue', obj.dssctx); 102 | obj.CheckForError(); 103 | end 104 | 105 | function result = get.Delimiters(obj) 106 | % String defining hard delimiters used to separate token on the command string. Default is , and =. The = separates token name from token value. These override whitesspace to separate tokens. 107 | result = calllib(obj.libname, 'ctx_Parser_Get_Delimiters', obj.dssctx); 108 | obj.CheckForError(); 109 | end 110 | function obj = set.Delimiters(obj, Value) 111 | calllib(obj.libname, 'ctx_Parser_Set_Delimiters', obj.dssctx, Value); 112 | obj.CheckForError(); 113 | end 114 | 115 | function result = get.EndQuote(obj) 116 | % String containing characters, in order, that match the beginning quote characters in BeginQuote. Default is "')]} 117 | result = calllib(obj.libname, 'ctx_Parser_Get_EndQuote', obj.dssctx); 118 | obj.CheckForError(); 119 | end 120 | function obj = set.EndQuote(obj, Value) 121 | calllib(obj.libname, 'ctx_Parser_Set_EndQuote', obj.dssctx, Value); 122 | obj.CheckForError(); 123 | end 124 | 125 | function result = get.IntValue(obj) 126 | % Return next parameter as a long integer. 127 | result = calllib(obj.libname, 'ctx_Parser_Get_IntValue', obj.dssctx); 128 | obj.CheckForError(); 129 | end 130 | 131 | function result = get.NextParam(obj) 132 | % Get next token and return tag name (before = sign) if any. See AutoIncrement. 133 | result = calllib(obj.libname, 'ctx_Parser_Get_NextParam', obj.dssctx); 134 | obj.CheckForError(); 135 | end 136 | 137 | function result = get.StrValue(obj) 138 | % Return next parameter as a string 139 | result = calllib(obj.libname, 'ctx_Parser_Get_StrValue', obj.dssctx); 140 | obj.CheckForError(); 141 | end 142 | 143 | function result = get.WhiteSpace(obj) 144 | % Get/set the characters used for White space in the command string. Default is blank and Tab. 145 | result = calllib(obj.libname, 'ctx_Parser_Get_WhiteSpace', obj.dssctx); 146 | obj.CheckForError(); 147 | end 148 | function obj = set.WhiteSpace(obj, Value) 149 | calllib(obj.libname, 'ctx_Parser_Set_WhiteSpace', obj.dssctx, Value); 150 | obj.CheckForError(); 151 | end 152 | end 153 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IReduceCkt.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IReduceCkt < DSS_MATLAB.Base 2 | % IReduceCkt: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % Zmag - Zmag (ohms) for Reduce Option for Z of short lines 6 | % KeepLoad - Keep load flag (T/F) for Reduction options that remove branches 7 | % EditString - Edit String for RemoveBranches functions 8 | % StartPDElement - Start element for Remove Branch function 9 | % EnergyMeter - Name of Energymeter to use for reduction 10 | % 11 | % Methods: 12 | % SaveCircuit - Save present (reduced) circuit Filename is listed in the Text Result interface 13 | % DoDefault - Do Default Reduction algorithm 14 | % DoShortLines - Do ShortLines algorithm: Set Zmag first if you don't want the default 15 | % DoDangling - Reduce Dangling Algorithm; branches with nothing connected 16 | % DoLoopBreak - 17 | % DoParallelLines - 18 | % DoSwitches - 19 | % Do1phLaterals - 20 | % DoBranchRemove - 21 | 22 | properties 23 | Zmag 24 | KeepLoad 25 | EditString 26 | StartPDElement 27 | EnergyMeter 28 | end 29 | 30 | methods (Access = public) 31 | function obj = IReduceCkt(apiutil) 32 | obj@DSS_MATLAB.Base(apiutil); 33 | end 34 | 35 | function obj = SaveCircuit(obj, CktName) 36 | % Save present (reduced) circuit 37 | % Filename is listed in the Text Result interface 38 | calllib(obj.libname, 'ctx_ReduceCkt_SaveCircuit', obj.dssctx, CktName); 39 | obj.CheckForError(); 40 | end 41 | 42 | function obj = DoDefault(obj) 43 | % Do Default Reduction algorithm 44 | calllib(obj.libname, 'ctx_ReduceCkt_DoDefault', obj.dssctx); 45 | obj.CheckForError(); 46 | end 47 | 48 | function obj = DoShortLines(obj) 49 | % Do ShortLines algorithm: Set Zmag first if you don't want the default 50 | calllib(obj.libname, 'ctx_ReduceCkt_DoShortLines', obj.dssctx); 51 | obj.CheckForError(); 52 | end 53 | 54 | function obj = DoDangling(obj) 55 | % Reduce Dangling Algorithm; branches with nothing connected 56 | calllib(obj.libname, 'ctx_ReduceCkt_DoDangling', obj.dssctx); 57 | obj.CheckForError(); 58 | end 59 | 60 | function obj = DoLoopBreak(obj) 61 | calllib(obj.libname, 'ctx_ReduceCkt_DoLoopBreak', obj.dssctx); 62 | obj.CheckForError(); 63 | end 64 | 65 | function obj = DoParallelLines(obj) 66 | calllib(obj.libname, 'ctx_ReduceCkt_DoParallelLines', obj.dssctx); 67 | obj.CheckForError(); 68 | end 69 | 70 | function obj = DoSwitches(obj) 71 | calllib(obj.libname, 'ctx_ReduceCkt_DoSwitches', obj.dssctx); 72 | obj.CheckForError(); 73 | end 74 | 75 | function obj = Do1phLaterals(obj) 76 | calllib(obj.libname, 'ctx_ReduceCkt_Do1phLaterals', obj.dssctx); 77 | obj.CheckForError(); 78 | end 79 | 80 | function obj = DoBranchRemove(obj) 81 | calllib(obj.libname, 'ctx_ReduceCkt_DoBranchRemove', obj.dssctx); 82 | obj.CheckForError(); 83 | end 84 | end 85 | methods 86 | 87 | function result = get.Zmag(obj) 88 | % Zmag (ohms) for Reduce Option for Z of short lines 89 | result = calllib(obj.libname, 'ctx_ReduceCkt_Get_Zmag', obj.dssctx); 90 | obj.CheckForError(); 91 | end 92 | function obj = set.Zmag(obj, Value) 93 | calllib(obj.libname, 'ctx_ReduceCkt_Set_Zmag', obj.dssctx, Value); 94 | obj.CheckForError(); 95 | end 96 | 97 | function result = get.KeepLoad(obj) 98 | % Keep load flag (T/F) for Reduction options that remove branches 99 | result = (calllib(obj.libname, 'ctx_ReduceCkt_Get_KeepLoad', obj.dssctx) ~= 0); 100 | obj.CheckForError(); 101 | end 102 | function obj = set.KeepLoad(obj, Value) 103 | calllib(obj.libname, 'ctx_ReduceCkt_Set_KeepLoad', obj.dssctx, bool(Value)); 104 | obj.CheckForError(); 105 | end 106 | 107 | function result = get.EditString(obj) 108 | % Edit String for RemoveBranches functions 109 | result = calllib(obj.libname, 'ctx_ReduceCkt_Get_EditString', obj.dssctx); 110 | obj.CheckForError(); 111 | end 112 | function obj = set.EditString(obj, Value) 113 | calllib(obj.libname, 'ctx_ReduceCkt_Set_EditString', obj.dssctx, Value); 114 | obj.CheckForError(); 115 | end 116 | 117 | function result = get.StartPDElement(obj) 118 | % Start element for Remove Branch function 119 | result = calllib(obj.libname, 'ctx_ReduceCkt_Get_StartPDElement', obj.dssctx); 120 | obj.CheckForError(); 121 | end 122 | function obj = set.StartPDElement(obj, Value) 123 | calllib(obj.libname, 'ctx_ReduceCkt_Set_StartPDElement', obj.dssctx, Value); 124 | obj.CheckForError(); 125 | end 126 | 127 | function result = get.EnergyMeter(obj) 128 | % Name of Energymeter to use for reduction 129 | result = calllib(obj.libname, 'ctx_ReduceCkt_Get_EnergyMeter', obj.dssctx); 130 | obj.CheckForError(); 131 | end 132 | function obj = set.EnergyMeter(obj, Value) 133 | calllib(obj.libname, 'ctx_ReduceCkt_Set_EnergyMeter', obj.dssctx, Value); 134 | obj.CheckForError(); 135 | end 136 | 137 | end 138 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IRelays.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IRelays < DSS_MATLAB.Base 2 | % IRelays: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all Relay names 6 | % Count - Number of Relay objects 7 | % First - Set first object of Relay; returns 0 if none. 8 | % Name - Get/sets the name of the current active Relay 9 | % Next - Sets next Relay active; returns 0 if no more. 10 | % idx - Sets next Relay active; returns 0 if no more. 11 | % MonitoredObj - Full name of object this Relay is monitoring. 12 | % MonitoredTerm - Number of terminal of monitored element that this Relay is monitoring. 13 | % SwitchedObj - Full name of element that will be switched when relay trips. 14 | % SwitchedTerm - Terminal number of the switched object that will be opened when the relay trips. 15 | % State - Get/Set present state of relay. If set to open, open relay's controlled element and lock out the relay. If set to close, close relay's controlled element and resets relay to first operation. 16 | % NormalState - Normal state of relay. 17 | % 18 | % Methods: 19 | % Open - Open relay's controlled element and lock out the relay. 20 | % Close - Close the switched object controlled by the relay. Resets relay to first operation. 21 | % Reset - Reset relay to normal state. If open, lock out the relay. If closed, resets relay to first operation. 22 | 23 | properties 24 | AllNames 25 | Count 26 | First 27 | Name 28 | Next 29 | idx 30 | MonitoredObj 31 | MonitoredTerm 32 | SwitchedObj 33 | SwitchedTerm 34 | State 35 | NormalState 36 | end 37 | 38 | methods (Access = public) 39 | function obj = IRelays(apiutil) 40 | obj@DSS_MATLAB.Base(apiutil); 41 | end 42 | 43 | function obj = Open(obj) 44 | % Open relay's controlled element and lock out the relay. 45 | calllib(obj.libname, 'ctx_Relays_Open', obj.dssctx); 46 | obj.CheckForError(); 47 | end 48 | 49 | function obj = Close(obj) 50 | % Close the switched object controlled by the relay. Resets relay to first operation. 51 | calllib(obj.libname, 'ctx_Relays_Close', obj.dssctx); 52 | obj.CheckForError(); 53 | end 54 | 55 | function obj = Reset(obj) 56 | % Reset relay to normal state. 57 | % If open, lock out the relay. 58 | % If closed, resets relay to first operation. 59 | calllib(obj.libname, 'ctx_Relays_Reset', obj.dssctx); 60 | obj.CheckForError(); 61 | end 62 | 63 | end 64 | methods 65 | 66 | function result = get.AllNames(obj) 67 | % Array of strings with all Relay names 68 | result = obj.apiutil.get_string_array('ctx_Relays_Get_AllNames'); 69 | end 70 | 71 | function result = get.Count(obj) 72 | % Number of Relay objects 73 | result = calllib(obj.libname, 'ctx_Relays_Get_Count', obj.dssctx); 74 | end 75 | 76 | function result = get.First(obj) 77 | % Set first object of Relay; returns 0 if none. 78 | result = calllib(obj.libname, 'ctx_Relays_Get_First', obj.dssctx); 79 | end 80 | 81 | function result = get.Name(obj) 82 | % Get/sets the name of the current active Relay 83 | result = calllib(obj.libname, 'ctx_Relays_Get_Name', obj.dssctx); 84 | end 85 | function obj = set.Name(obj, Value) 86 | calllib(obj.libname, 'ctx_Relays_Set_Name', obj.dssctx, Value); 87 | obj.CheckForError(); 88 | end 89 | 90 | function result = get.Next(obj) 91 | % Sets next Relay active; returns 0 if no more. 92 | result = calllib(obj.libname, 'ctx_Relays_Get_Next', obj.dssctx); 93 | end 94 | 95 | function result = get.idx(obj) 96 | % Get/set active Relay by index; 1..Count 97 | result = calllib(obj.libname, 'ctx_Relays_Get_idx', obj.dssctx); 98 | end 99 | function obj = set.idx(obj, Value) 100 | calllib(obj.libname, 'ctx_Relays_Set_idx', obj.dssctx, Value); 101 | obj.CheckForError(); 102 | end 103 | 104 | 105 | function result = get.MonitoredObj(obj) 106 | % Full name of object this Relay is monitoring. 107 | result = calllib(obj.libname, 'ctx_Relays_Get_MonitoredObj', obj.dssctx); 108 | obj.CheckForError(); 109 | end 110 | function obj = set.MonitoredObj(obj, Value) 111 | calllib(obj.libname, 'ctx_Relays_Set_MonitoredObj', obj.dssctx, Value); 112 | obj.CheckForError(); 113 | end 114 | 115 | function result = get.MonitoredTerm(obj) 116 | % Number of terminal of monitored element that this Relay is monitoring. 117 | result = calllib(obj.libname, 'ctx_Relays_Get_MonitoredTerm', obj.dssctx); 118 | obj.CheckForError(); 119 | end 120 | function obj = set.MonitoredTerm(obj, Value) 121 | calllib(obj.libname, 'ctx_Relays_Set_MonitoredTerm', obj.dssctx, Value); 122 | obj.CheckForError(); 123 | end 124 | 125 | function result = get.SwitchedObj(obj) 126 | % Full name of element that will be switched when relay trips. 127 | result = calllib(obj.libname, 'ctx_Relays_Get_SwitchedObj', obj.dssctx); 128 | obj.CheckForError(); 129 | end 130 | function obj = set.SwitchedObj(obj, Value) 131 | calllib(obj.libname, 'ctx_Relays_Set_SwitchedObj', obj.dssctx, Value); 132 | obj.CheckForError(); 133 | end 134 | 135 | function result = get.SwitchedTerm(obj) 136 | % Terminal number of the switched object that will be opened when the relay trips. 137 | result = calllib(obj.libname, 'ctx_Relays_Get_SwitchedTerm', obj.dssctx); 138 | obj.CheckForError(); 139 | end 140 | function obj = set.SwitchedTerm(obj, Value) 141 | calllib(obj.libname, 'ctx_Relays_Set_SwitchedTerm', obj.dssctx, Value); 142 | obj.CheckForError(); 143 | end 144 | 145 | function result = get.State(obj) 146 | % Get/Set present state of relay. 147 | % If set to open, open relay's controlled element and lock out the relay. 148 | % If set to close, close relay's controlled element and resets relay to first operation. 149 | result = calllib(obj.libname, 'ctx_Relays_Get_State', obj.dssctx); 150 | obj.CheckForError(); 151 | end 152 | function obj = set.State(obj, Value) 153 | calllib(obj.libname, 'ctx_Relays_Set_State', obj.dssctx, Value); 154 | obj.CheckForError(); 155 | end 156 | 157 | function result = get.NormalState(obj) 158 | % Normal state of relay. 159 | result = calllib(obj.libname, 'ctx_Relays_Get_NormalState', obj.dssctx); 160 | obj.CheckForError(); 161 | end 162 | function obj = set.NormalState(obj, Value) 163 | calllib(obj.libname, 'ctx_Relays_Set_NormalState', obj.dssctx, Value); 164 | obj.CheckForError(); 165 | end 166 | end 167 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/ISensors.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) ISensors < DSS_MATLAB.Base 2 | % ISensors: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all Sensor names 6 | % Count - Number of Sensor objects 7 | % First - Set first object of Sensor; returns 0 if none. 8 | % Name - Get/sets the name of the current active Sensor 9 | % Next - Sets next Sensor active; returns 0 if no more. 10 | % idx - Sets next Sensor active; returns 0 if no more. 11 | % Currents - Array of doubles for the line current measurements; don't use with kWS and kVARS. 12 | % IsDelta - True if measured voltages are line-line. Currents are always line currents. 13 | % MeteredElement - Full Name of the measured element 14 | % MeteredTerminal - Number of the measured terminal in the measured element. 15 | % PctError - Assumed percent error in the Sensor measurement. Default is 1. 16 | % ReverseDelta - True if voltage measurements are 1-3, 3-2, 2-1. 17 | % Weight - Weighting factor for this Sensor measurement with respect to other Sensors. Default is 1. 18 | % kVARS - Array of doubles for Q measurements. Overwrites Currents with a new estimate using kWS. 19 | % kVS - Array of doubles for the LL or LN (depending on Delta connection) voltage measurements. 20 | % kVbase - Voltage base for the sensor measurements. LL for 2 and 3-phase sensors, LN for 1-phase sensors. 21 | % kWS - Array of doubles for P measurements. Overwrites Currents with a new estimate using kVARS. 22 | % AllocationFactor - Array of doubles for the allocation factors for each phase. 23 | % 24 | % Methods: 25 | % Reset - 26 | % ResetAll - 27 | 28 | properties 29 | AllNames 30 | Count 31 | First 32 | Name 33 | Next 34 | idx 35 | Currents 36 | IsDelta 37 | MeteredElement 38 | MeteredTerminal 39 | PctError 40 | ReverseDelta 41 | Weight 42 | kVARS 43 | kVS 44 | kVbase 45 | kWS 46 | AllocationFactor 47 | end 48 | 49 | methods (Access = public) 50 | function obj = ISensors(apiutil) 51 | obj@DSS_MATLAB.Base(apiutil); 52 | end 53 | 54 | function obj = Reset(obj) 55 | calllib(obj.libname, 'ctx_Sensors_Reset', obj.dssctx); 56 | obj.CheckForError(); 57 | end 58 | 59 | function obj = ResetAll(obj) 60 | calllib(obj.libname, 'ctx_Sensors_ResetAll', obj.dssctx); 61 | obj.CheckForError(); 62 | end 63 | 64 | end 65 | methods 66 | 67 | function result = get.AllNames(obj) 68 | % Array of strings with all Sensor names 69 | result = obj.apiutil.get_string_array('ctx_Sensors_Get_AllNames'); 70 | end 71 | 72 | function result = get.Count(obj) 73 | % Number of Sensor objects 74 | result = calllib(obj.libname, 'ctx_Sensors_Get_Count', obj.dssctx); 75 | end 76 | 77 | function result = get.First(obj) 78 | % Set first object of Sensor; returns 0 if none. 79 | result = calllib(obj.libname, 'ctx_Sensors_Get_First', obj.dssctx); 80 | end 81 | 82 | function result = get.Name(obj) 83 | % Get/sets the name of the current active Sensor 84 | result = calllib(obj.libname, 'ctx_Sensors_Get_Name', obj.dssctx); 85 | end 86 | function obj = set.Name(obj, Value) 87 | calllib(obj.libname, 'ctx_Sensors_Set_Name', obj.dssctx, Value); 88 | obj.CheckForError(); 89 | end 90 | 91 | function result = get.Next(obj) 92 | % Sets next Sensor active; returns 0 if no more. 93 | result = calllib(obj.libname, 'ctx_Sensors_Get_Next', obj.dssctx); 94 | end 95 | 96 | function result = get.idx(obj) 97 | % Get/set active Sensor by index; 1..Count 98 | result = calllib(obj.libname, 'ctx_Sensors_Get_idx', obj.dssctx); 99 | end 100 | function obj = set.idx(obj, Value) 101 | calllib(obj.libname, 'ctx_Sensors_Set_idx', obj.dssctx, Value); 102 | obj.CheckForError(); 103 | end 104 | 105 | 106 | function result = get.Currents(obj) 107 | % Array of doubles for the line current measurements; don't use with kWS and kVARS. 108 | calllib(obj.libname, 'ctx_Sensors_Get_Currents_GR', obj.dssctx); 109 | obj.CheckForError(); 110 | result = obj.apiutil.get_float64_gr_array(); 111 | end 112 | function obj = set.Currents(obj, Value) 113 | calllib(obj.libname, 'ctx_Sensors_Set_Currents', obj.dssctx, Value, numel(Value)); 114 | obj.CheckForError(); 115 | end 116 | 117 | function result = get.IsDelta(obj) 118 | % True if measured voltages are line-line. Currents are always line currents. 119 | result = (calllib(obj.libname, 'ctx_Sensors_Get_IsDelta', obj.dssctx) ~= 0); 120 | obj.CheckForError(); 121 | end 122 | function obj = set.IsDelta(obj, Value) 123 | calllib(obj.libname, 'ctx_Sensors_Set_IsDelta', obj.dssctx, Value); 124 | obj.CheckForError(); 125 | end 126 | 127 | function result = get.MeteredElement(obj) 128 | % Full Name of the measured element 129 | result = calllib(obj.libname, 'ctx_Sensors_Get_MeteredElement', obj.dssctx); 130 | obj.CheckForError(); 131 | end 132 | function obj = set.MeteredElement(obj, Value) 133 | calllib(obj.libname, 'ctx_Sensors_Set_MeteredElement', obj.dssctx, Value); 134 | obj.CheckForError(); 135 | end 136 | 137 | function result = get.MeteredTerminal(obj) 138 | % Number of the measured terminal in the measured element. 139 | result = calllib(obj.libname, 'ctx_Sensors_Get_MeteredTerminal', obj.dssctx); 140 | obj.CheckForError(); 141 | end 142 | function obj = set.MeteredTerminal(obj, Value) 143 | calllib(obj.libname, 'ctx_Sensors_Set_MeteredTerminal', obj.dssctx, Value); 144 | obj.CheckForError(); 145 | end 146 | 147 | function result = get.PctError(obj) 148 | % Assumed percent error in the Sensor measurement. Default is 1. 149 | result = calllib(obj.libname, 'ctx_Sensors_Get_PctError', obj.dssctx); 150 | obj.CheckForError(); 151 | end 152 | function obj = set.PctError(obj, Value) 153 | calllib(obj.libname, 'ctx_Sensors_Set_PctError', obj.dssctx, Value); 154 | obj.CheckForError(); 155 | end 156 | 157 | function result = get.ReverseDelta(obj) 158 | % True if voltage measurements are 1-3, 3-2, 2-1. 159 | result = (calllib(obj.libname, 'ctx_Sensors_Get_ReverseDelta', obj.dssctx) ~= 0); 160 | obj.CheckForError(); 161 | end 162 | function obj = set.ReverseDelta(obj, Value) 163 | calllib(obj.libname, 'ctx_Sensors_Set_ReverseDelta', obj.dssctx, Value); 164 | obj.CheckForError(); 165 | end 166 | 167 | function result = get.Weight(obj) 168 | % Weighting factor for this Sensor measurement with respect to other Sensors. Default is 1. 169 | result = calllib(obj.libname, 'ctx_Sensors_Get_Weight', obj.dssctx); 170 | obj.CheckForError(); 171 | end 172 | function obj = set.Weight(obj, Value) 173 | calllib(obj.libname, 'ctx_Sensors_Set_Weight', obj.dssctx, Value); 174 | obj.CheckForError(); 175 | end 176 | 177 | function result = get.kVARS(obj) 178 | % Array of doubles for Q measurements. Overwrites Currents with a new estimate using kWS. 179 | calllib(obj.libname, 'ctx_Sensors_Get_kVARS_GR', obj.dssctx); 180 | obj.CheckForError(); 181 | result = obj.apiutil.get_float64_gr_array(); 182 | end 183 | function obj = set.kVARS(obj, Value) 184 | calllib(obj.libname, 'ctx_Sensors_Set_kVARS', obj.dssctx, Value, numel(Value)); 185 | obj.CheckForError(); 186 | end 187 | 188 | function result = get.kVS(obj) 189 | % Array of doubles for the LL or LN (depending on Delta connection) voltage measurements. 190 | calllib(obj.libname, 'ctx_Sensors_Get_kVS_GR', obj.dssctx); 191 | obj.CheckForError(); 192 | result = obj.apiutil.get_float64_gr_array(); 193 | end 194 | function obj = set.kVS(obj, Value) 195 | calllib(obj.libname, 'ctx_Sensors_Set_kVS', obj.dssctx, Value, numel(Value)); 196 | obj.CheckForError(); 197 | end 198 | 199 | function result = get.kVbase(obj) 200 | % Voltage base for the sensor measurements. LL for 2 and 3-phase sensors, LN for 1-phase sensors. 201 | result = calllib(obj.libname, 'ctx_Sensors_Get_kVbase', obj.dssctx); 202 | obj.CheckForError(); 203 | end 204 | function obj = set.kVbase(obj, Value) 205 | calllib(obj.libname, 'ctx_Sensors_Set_kVbase', obj.dssctx, Value); 206 | obj.CheckForError(); 207 | end 208 | 209 | function result = get.kWS(obj) 210 | % Array of doubles for P measurements. Overwrites Currents with a new estimate using kVARS. 211 | calllib(obj.libname, 'ctx_Sensors_Get_kWS_GR', obj.dssctx); 212 | obj.CheckForError(); 213 | result = obj.apiutil.get_float64_gr_array(); 214 | end 215 | function obj = set.kWS(obj, Value) 216 | calllib(obj.libname, 'ctx_Sensors_Set_kWS', obj.dssctx, Value, numel(Value)); 217 | obj.CheckForError(); 218 | end 219 | 220 | function result = get.AllocationFactor(obj) 221 | % Array of doubles for the allocation factors for each phase. 222 | calllib(obj.libname, 'ctx_Sensors_Get_AllocationFactor_GR', obj.dssctx); 223 | obj.CheckForError(); 224 | result = obj.apiutil.get_float64_gr_array(); 225 | end 226 | end 227 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IStorages.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IStorages < DSS_MATLAB.Base 2 | % IStorages: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all Storage names 6 | % Count - Number of Storage objects 7 | % First - Set first object of Storage; returns 0 if none. 8 | % Name - Get/sets the name of the current active Storage 9 | % Next - Sets next Storage active; returns 0 if no more. 10 | % idx - Sets next Storage active; returns 0 if no more. 11 | % puSOC - Per unit state of charge 12 | % State - Get/set state: 0=Idling; 1=Discharging; -1=Charging; Related enumeration: StorageStates 13 | % RegisterNames - Array of Names of all Storage energy meter registers 14 | % RegisterValues - Array of values in Storage registers. 15 | 16 | properties 17 | AllNames 18 | Count 19 | First 20 | Name 21 | Next 22 | idx 23 | puSOC 24 | State 25 | RegisterNames 26 | RegisterValues 27 | end 28 | 29 | methods (Access = public) 30 | function obj = IStorages(apiutil) 31 | obj@DSS_MATLAB.Base(apiutil); 32 | end 33 | 34 | end 35 | methods 36 | 37 | function result = get.AllNames(obj) 38 | % Array of strings with all Storage names 39 | result = obj.apiutil.get_string_array('ctx_Storages_Get_AllNames'); 40 | end 41 | 42 | function result = get.Count(obj) 43 | % Number of Storage objects 44 | result = calllib(obj.libname, 'ctx_Storages_Get_Count', obj.dssctx); 45 | end 46 | 47 | function result = get.First(obj) 48 | % Set first object of Storage; returns 0 if none. 49 | result = calllib(obj.libname, 'ctx_Storages_Get_First', obj.dssctx); 50 | end 51 | 52 | function result = get.Name(obj) 53 | % Get/sets the name of the current active Storage 54 | result = calllib(obj.libname, 'ctx_Storages_Get_Name', obj.dssctx); 55 | end 56 | function obj = set.Name(obj, Value) 57 | calllib(obj.libname, 'ctx_Storages_Set_Name', obj.dssctx, Value); 58 | obj.CheckForError(); 59 | end 60 | 61 | function result = get.Next(obj) 62 | % Sets next Storage active; returns 0 if no more. 63 | result = calllib(obj.libname, 'ctx_Storages_Get_Next', obj.dssctx); 64 | end 65 | 66 | function result = get.idx(obj) 67 | % Get/set active Storage by index; 1..Count 68 | result = calllib(obj.libname, 'ctx_Storages_Get_idx', obj.dssctx); 69 | end 70 | function obj = set.idx(obj, Value) 71 | calllib(obj.libname, 'ctx_Storages_Set_idx', obj.dssctx, Value); 72 | obj.CheckForError(); 73 | end 74 | 75 | 76 | function result = get.puSOC(obj) 77 | % Per unit state of charge 78 | result = calllib(obj.libname, 'ctx_Storages_Get_puSOC', obj.dssctx); 79 | obj.CheckForError(); 80 | end 81 | function obj = set.puSOC(obj, Value) 82 | calllib(obj.libname, 'ctx_Storages_Set_puSOC', obj.dssctx, Value); 83 | obj.CheckForError(); 84 | end 85 | 86 | function result = get.State(obj) 87 | % Get/set state: 0=Idling; 1=Discharging; -1=Charging; 88 | % 89 | % Related enumeration: StorageStates 90 | result = calllib(obj.libname, 'ctx_Storages_Get_State', obj.dssctx); 91 | obj.CheckForError(); 92 | end 93 | function obj = set.State(obj, Value) 94 | calllib(obj.libname, 'ctx_Storages_Set_State', obj.dssctx, Value); 95 | obj.CheckForError(); 96 | end 97 | 98 | function result = get.RegisterNames(obj) 99 | % Array of Names of all Storage energy meter registers 100 | result = obj.apiutil.get_string_array('ctx_Storages_Get_RegisterNames'); 101 | obj.CheckForError(); 102 | end 103 | 104 | function result = get.RegisterValues(obj) 105 | % Array of values in Storage registers. 106 | calllib(obj.libname, 'ctx_Storages_Get_RegisterValues_GR', obj.dssctx); 107 | obj.CheckForError(); 108 | result = obj.apiutil.get_float64_gr_array(); 109 | end 110 | end 111 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/ISwtControls.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) ISwtControls < DSS_MATLAB.Base 2 | % ISwtControls: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all SwtControl names 6 | % Count - Number of SwtControl objects 7 | % First - Set first object of SwtControl; returns 0 if none. 8 | % Name - Get/sets the name of the current active SwtControl 9 | % Next - Sets next SwtControl active; returns 0 if no more. 10 | % idx - Sets next SwtControl active; returns 0 if no more. 11 | % Action - Open or Close the switch. No effect if switch is locked. However, Reset removes any lock and then closes the switch (shelf state). 12 | % Delay - Time delay [s] betwen arming and opening or closing the switch. Control may reset before actually operating the switch. 13 | % IsLocked - The lock prevents both manual and automatic switch operation. 14 | % NormalState - Get/set Normal state of switch (see actioncodes) dssActionOpen or dssActionClose 15 | % State - Set it to force the switch to a specified state, otherwise read its present state. 16 | % SwitchedObj - Full name of the switched element. 17 | % SwitchedTerm - Terminal number where the switch is located on the SwitchedObj 18 | % 19 | % Methods: 20 | % Reset - 21 | 22 | properties 23 | AllNames 24 | Count 25 | First 26 | Name 27 | Next 28 | idx 29 | Action 30 | Delay 31 | IsLocked 32 | NormalState 33 | State 34 | SwitchedObj 35 | SwitchedTerm 36 | end 37 | 38 | methods (Access = public) 39 | function obj = ISwtControls(apiutil) 40 | obj@DSS_MATLAB.Base(apiutil); 41 | end 42 | 43 | function obj = Reset(obj) 44 | calllib(obj.libname, 'ctx_SwtControls_Reset', obj.dssctx); 45 | obj.CheckForError(); 46 | end 47 | 48 | end 49 | methods 50 | 51 | function result = get.AllNames(obj) 52 | % Array of strings with all SwtControl names 53 | result = obj.apiutil.get_string_array('ctx_SwtControls_Get_AllNames'); 54 | end 55 | 56 | function result = get.Count(obj) 57 | % Number of SwtControl objects 58 | result = calllib(obj.libname, 'ctx_SwtControls_Get_Count', obj.dssctx); 59 | end 60 | 61 | function result = get.First(obj) 62 | % Set first object of SwtControl; returns 0 if none. 63 | result = calllib(obj.libname, 'ctx_SwtControls_Get_First', obj.dssctx); 64 | end 65 | 66 | function result = get.Name(obj) 67 | % Get/sets the name of the current active SwtControl 68 | result = calllib(obj.libname, 'ctx_SwtControls_Get_Name', obj.dssctx); 69 | end 70 | function obj = set.Name(obj, Value) 71 | calllib(obj.libname, 'ctx_SwtControls_Set_Name', obj.dssctx, Value); 72 | obj.CheckForError(); 73 | end 74 | 75 | function result = get.Next(obj) 76 | % Sets next SwtControl active; returns 0 if no more. 77 | result = calllib(obj.libname, 'ctx_SwtControls_Get_Next', obj.dssctx); 78 | end 79 | 80 | function result = get.idx(obj) 81 | % Get/set active SwtControl by index; 1..Count 82 | result = calllib(obj.libname, 'ctx_SwtControls_Get_idx', obj.dssctx); 83 | end 84 | function obj = set.idx(obj, Value) 85 | calllib(obj.libname, 'ctx_SwtControls_Set_idx', obj.dssctx, Value); 86 | obj.CheckForError(); 87 | end 88 | 89 | 90 | function result = get.Action(obj) 91 | % Open or Close the switch. No effect if switch is locked. However, Reset removes any lock and then closes the switch (shelf state). 92 | result = calllib(obj.libname, 'ctx_SwtControls_Get_Action', obj.dssctx); 93 | obj.CheckForError(); 94 | end 95 | function obj = set.Action(obj, Value) 96 | calllib(obj.libname, 'ctx_SwtControls_Set_Action', obj.dssctx, Value); 97 | obj.CheckForError(); 98 | end 99 | 100 | function result = get.Delay(obj) 101 | % Time delay [s] betwen arming and opening or closing the switch. Control may reset before actually operating the switch. 102 | result = calllib(obj.libname, 'ctx_SwtControls_Get_Delay', obj.dssctx); 103 | obj.CheckForError(); 104 | end 105 | function obj = set.Delay(obj, Value) 106 | calllib(obj.libname, 'ctx_SwtControls_Set_Delay', obj.dssctx, Value); 107 | obj.CheckForError(); 108 | end 109 | 110 | function result = get.IsLocked(obj) 111 | % The lock prevents both manual and automatic switch operation. 112 | result = (calllib(obj.libname, 'ctx_SwtControls_Get_IsLocked', obj.dssctx) ~= 0); 113 | obj.CheckForError(); 114 | end 115 | function obj = set.IsLocked(obj, Value) 116 | calllib(obj.libname, 'ctx_SwtControls_Set_IsLocked', obj.dssctx, Value); 117 | obj.CheckForError(); 118 | end 119 | 120 | function result = get.NormalState(obj) 121 | % Get/set Normal state of switch (see actioncodes) dssActionOpen or dssActionClose 122 | result = calllib(obj.libname, 'ctx_SwtControls_Get_NormalState', obj.dssctx); 123 | obj.CheckForError(); 124 | end 125 | function obj = set.NormalState(obj, Value) 126 | calllib(obj.libname, 'ctx_SwtControls_Set_NormalState', obj.dssctx, Value); 127 | obj.CheckForError(); 128 | end 129 | 130 | function result = get.State(obj) 131 | % Set it to force the switch to a specified state, otherwise read its present state. 132 | result = calllib(obj.libname, 'ctx_SwtControls_Get_State', obj.dssctx); 133 | obj.CheckForError(); 134 | end 135 | function obj = set.State(obj, Value) 136 | calllib(obj.libname, 'ctx_SwtControls_Set_State', obj.dssctx, Value); 137 | obj.CheckForError(); 138 | end 139 | 140 | function result = get.SwitchedObj(obj) 141 | % Full name of the switched element. 142 | result = calllib(obj.libname, 'ctx_SwtControls_Get_SwitchedObj', obj.dssctx); 143 | obj.CheckForError(); 144 | end 145 | function obj = set.SwitchedObj(obj, Value) 146 | calllib(obj.libname, 'ctx_SwtControls_Set_SwitchedObj', obj.dssctx, Value); 147 | obj.CheckForError(); 148 | end 149 | 150 | function result = get.SwitchedTerm(obj) 151 | % Terminal number where the switch is located on the SwitchedObj 152 | result = calllib(obj.libname, 'ctx_SwtControls_Get_SwitchedTerm', obj.dssctx); 153 | obj.CheckForError(); 154 | end 155 | function obj = set.SwitchedTerm(obj, Value) 156 | calllib(obj.libname, 'ctx_SwtControls_Set_SwitchedTerm', obj.dssctx, Value); 157 | obj.CheckForError(); 158 | end 159 | end 160 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/ITSData.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) ITSData < DSS_MATLAB.Base 2 | % ITSData: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all TSData names 6 | % Count - Number of TSData objects 7 | % First - Set first object of TSData; returns 0 if none. 8 | % Name - Get/sets the name of the current active TSData 9 | % Next - Sets next TSData active; returns 0 if no more. 10 | % idx - Sets next TSData active; returns 0 if no more. 11 | % EmergAmps - Emergency ampere rating 12 | % NormAmps - Normal Ampere rating 13 | % Rdc - 14 | % Rac - 15 | % GMRac - 16 | % GMRUnits - 17 | % Radius - 18 | % RadiusUnits - 19 | % ResistanceUnits - 20 | % Diameter - 21 | % EpsR - 22 | % InsLayer - 23 | % DiaIns - 24 | % DiaCable - 25 | % DiaShield - 26 | % TapeLayer - 27 | % TapeLap - 28 | 29 | properties 30 | AllNames 31 | Count 32 | First 33 | Name 34 | Next 35 | idx 36 | EmergAmps 37 | NormAmps 38 | Rdc 39 | Rac 40 | GMRac 41 | GMRUnits 42 | Radius 43 | RadiusUnits 44 | ResistanceUnits 45 | Diameter 46 | EpsR 47 | InsLayer 48 | DiaIns 49 | DiaCable 50 | DiaShield 51 | TapeLayer 52 | TapeLap 53 | end 54 | 55 | methods (Access = public) 56 | function obj = ITSData(apiutil) 57 | obj@DSS_MATLAB.Base(apiutil); 58 | end 59 | 60 | end 61 | methods 62 | 63 | function result = get.AllNames(obj) 64 | % Array of strings with all TSData names 65 | result = obj.apiutil.get_string_array('ctx_TSData_Get_AllNames'); 66 | end 67 | 68 | function result = get.Count(obj) 69 | % Number of TSData objects 70 | result = calllib(obj.libname, 'ctx_TSData_Get_Count', obj.dssctx); 71 | end 72 | 73 | function result = get.First(obj) 74 | % Set first object of TSData; returns 0 if none. 75 | result = calllib(obj.libname, 'ctx_TSData_Get_First', obj.dssctx); 76 | end 77 | 78 | function result = get.Name(obj) 79 | % Get/sets the name of the current active TSData 80 | result = calllib(obj.libname, 'ctx_TSData_Get_Name', obj.dssctx); 81 | end 82 | function obj = set.Name(obj, Value) 83 | calllib(obj.libname, 'ctx_TSData_Set_Name', obj.dssctx, Value); 84 | obj.CheckForError(); 85 | end 86 | 87 | function result = get.Next(obj) 88 | % Sets next TSData active; returns 0 if no more. 89 | result = calllib(obj.libname, 'ctx_TSData_Get_Next', obj.dssctx); 90 | end 91 | 92 | function result = get.idx(obj) 93 | % Get/set active TSData by index; 1..Count 94 | result = calllib(obj.libname, 'ctx_TSData_Get_idx', obj.dssctx); 95 | end 96 | function obj = set.idx(obj, Value) 97 | calllib(obj.libname, 'ctx_TSData_Set_idx', obj.dssctx, Value); 98 | obj.CheckForError(); 99 | end 100 | 101 | 102 | function result = get.EmergAmps(obj) 103 | % Emergency ampere rating 104 | result = calllib(obj.libname, 'ctx_TSData_Get_EmergAmps', obj.dssctx); 105 | obj.CheckForError(); 106 | end 107 | function obj = set.EmergAmps(obj, Value) 108 | calllib(obj.libname, 'ctx_TSData_Set_EmergAmps', obj.dssctx, Value); 109 | obj.CheckForError(); 110 | end 111 | 112 | function result = get.NormAmps(obj) 113 | % Normal Ampere rating 114 | result = calllib(obj.libname, 'ctx_TSData_Get_NormAmps', obj.dssctx); 115 | obj.CheckForError(); 116 | end 117 | function obj = set.NormAmps(obj, Value) 118 | calllib(obj.libname, 'ctx_TSData_Set_NormAmps', obj.dssctx, Value); 119 | obj.CheckForError(); 120 | end 121 | 122 | function result = get.Rdc(obj) 123 | result = calllib(obj.libname, 'ctx_TSData_Get_Rdc', obj.dssctx); 124 | obj.CheckForError(); 125 | end 126 | function obj = set.Rdc(obj, Value) 127 | calllib(obj.libname, 'ctx_TSData_Set_Rdc', obj.dssctx, Value); 128 | obj.CheckForError(); 129 | end 130 | 131 | function result = get.Rac(obj) 132 | result = calllib(obj.libname, 'ctx_TSData_Get_Rac', obj.dssctx); 133 | obj.CheckForError(); 134 | end 135 | function obj = set.Rac(obj, Value) 136 | calllib(obj.libname, 'ctx_TSData_Set_Rac', obj.dssctx, Value); 137 | obj.CheckForError(); 138 | end 139 | 140 | function result = get.GMRac(obj) 141 | result = calllib(obj.libname, 'ctx_TSData_Get_GMRac', obj.dssctx); 142 | obj.CheckForError(); 143 | end 144 | function obj = set.GMRac(obj, Value) 145 | calllib(obj.libname, 'ctx_TSData_Set_GMRac', obj.dssctx, Value); 146 | obj.CheckForError(); 147 | end 148 | 149 | function result = get.GMRUnits(obj) 150 | result = calllib(obj.libname, 'ctx_TSData_Get_GMRUnits', obj.dssctx); 151 | obj.CheckForError(); 152 | end 153 | function obj = set.GMRUnits(obj, Value) 154 | calllib(obj.libname, 'ctx_TSData_Set_GMRUnits', obj.dssctx, Value); 155 | obj.CheckForError(); 156 | end 157 | 158 | function result = get.Radius(obj) 159 | result = calllib(obj.libname, 'ctx_TSData_Get_Radius', obj.dssctx); 160 | obj.CheckForError(); 161 | end 162 | function obj = set.Radius(obj, Value) 163 | calllib(obj.libname, 'ctx_TSData_Set_Radius', obj.dssctx, Value); 164 | obj.CheckForError(); 165 | end 166 | 167 | function result = get.RadiusUnits(obj) 168 | result = calllib(obj.libname, 'ctx_TSData_Get_RadiusUnits', obj.dssctx); 169 | obj.CheckForError(); 170 | end 171 | function obj = set.RadiusUnits(obj, Value) 172 | calllib(obj.libname, 'ctx_TSData_Set_RadiusUnits', obj.dssctx, Value); 173 | obj.CheckForError(); 174 | end 175 | 176 | function result = get.ResistanceUnits(obj) 177 | result = calllib(obj.libname, 'ctx_TSData_Get_ResistanceUnits', obj.dssctx); 178 | obj.CheckForError(); 179 | end 180 | function obj = set.ResistanceUnits(obj, Value) 181 | calllib(obj.libname, 'ctx_TSData_Set_ResistanceUnits', obj.dssctx, Value); 182 | obj.CheckForError(); 183 | end 184 | 185 | function result = get.Diameter(obj) 186 | result = calllib(obj.libname, 'ctx_TSData_Get_Diameter', obj.dssctx); 187 | obj.CheckForError(); 188 | end 189 | function obj = set.Diameter(obj, Value) 190 | calllib(obj.libname, 'ctx_TSData_Set_Diameter', obj.dssctx, Value); 191 | obj.CheckForError(); 192 | end 193 | 194 | function result = get.EpsR(obj) 195 | result = calllib(obj.libname, 'ctx_TSData_Get_EpsR', obj.dssctx); 196 | obj.CheckForError(); 197 | end 198 | function obj = set.EpsR(obj, Value) 199 | calllib(obj.libname, 'ctx_TSData_Set_EpsR', obj.dssctx, Value); 200 | obj.CheckForError(); 201 | end 202 | 203 | function result = get.InsLayer(obj) 204 | result = calllib(obj.libname, 'ctx_TSData_Get_InsLayer', obj.dssctx); 205 | obj.CheckForError(); 206 | end 207 | function obj = set.InsLayer(obj, Value) 208 | calllib(obj.libname, 'ctx_TSData_Set_InsLayer', obj.dssctx, Value); 209 | obj.CheckForError(); 210 | end 211 | 212 | function result = get.DiaIns(obj) 213 | result = calllib(obj.libname, 'ctx_TSData_Get_DiaIns', obj.dssctx); 214 | obj.CheckForError(); 215 | end 216 | function obj = set.DiaIns(obj, Value) 217 | calllib(obj.libname, 'ctx_TSData_Set_DiaIns', obj.dssctx, Value); 218 | obj.CheckForError(); 219 | end 220 | 221 | function result = get.DiaCable(obj) 222 | result = calllib(obj.libname, 'ctx_TSData_Get_DiaCable', obj.dssctx); 223 | obj.CheckForError(); 224 | end 225 | function obj = set.DiaCable(obj, Value) 226 | calllib(obj.libname, 'ctx_TSData_Set_DiaCable', obj.dssctx, Value); 227 | obj.CheckForError(); 228 | end 229 | 230 | function result = get.DiaShield(obj) 231 | result = calllib(obj.libname, 'ctx_TSData_Get_DiaShield', obj.dssctx); 232 | obj.CheckForError(); 233 | end 234 | function obj = set.DiaShield(obj, Value) 235 | calllib(obj.libname, 'ctx_TSData_Set_DiaShield', obj.dssctx, Value); 236 | obj.CheckForError(); 237 | end 238 | 239 | function result = get.TapeLayer(obj) 240 | result = calllib(obj.libname, 'ctx_TSData_Get_TapeLayer', obj.dssctx); 241 | obj.CheckForError(); 242 | end 243 | function obj = set.TapeLayer(obj, Value) 244 | calllib(obj.libname, 'ctx_TSData_Set_TapeLayer', obj.dssctx, Value); 245 | obj.CheckForError(); 246 | end 247 | 248 | function result = get.TapeLap(obj) 249 | result = calllib(obj.libname, 'ctx_TSData_Get_TapeLap', obj.dssctx); 250 | obj.CheckForError(); 251 | end 252 | function obj = set.TapeLap(obj, Value) 253 | calllib(obj.libname, 'ctx_TSData_Set_TapeLap', obj.dssctx, Value); 254 | obj.CheckForError(); 255 | end 256 | end 257 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IText.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IText < DSS_MATLAB.Base 2 | % IText: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % Command - Input command string for the DSS. 6 | % Result - Result string for the last command. 7 | % 8 | % Methods: 9 | % Commands - Runs a large string as commands directly in the DSS engine. (API Extension) 10 | 11 | properties 12 | Command 13 | Result 14 | end 15 | 16 | methods (Access = public) 17 | function obj = IText(apiutil) 18 | obj@DSS_MATLAB.Base(apiutil); 19 | end 20 | 21 | function obj = Commands(obj, Value) 22 | % Runs a large string as commands directly in the DSS engine. 23 | % Intermediate results (from Text.Result) are ignored. 24 | % 25 | % (API Extension) 26 | obj.apiutil.set_string_array('ctx_Text_CommandArray', Value); 27 | obj.CheckForError(); 28 | end 29 | end 30 | methods 31 | 32 | function result = get.Command(obj) 33 | % Input command string for the DSS. 34 | result = calllib(obj.libname, 'ctx_Text_Get_Command', obj.dssctx); 35 | obj.CheckForError(); 36 | end 37 | function obj = set.Command(obj, Value) 38 | calllib(obj.libname, 'ctx_Text_Set_Command', obj.dssctx, Value); 39 | obj.CheckForError(); 40 | end 41 | 42 | function result = get.Result(obj) 43 | % Result string for the last command. 44 | result = calllib(obj.libname, 'ctx_Text_Get_Result', obj.dssctx); 45 | obj.CheckForError(); 46 | end 47 | end 48 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/ITopology.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) ITopology < DSS_MATLAB.Base 2 | % ITopology: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % ActiveBranch - Returns index of the active branch 6 | % ActiveLevel - Topological depth of the active branch 7 | % AllIsolatedBranches - Array of all isolated branch names. 8 | % AllIsolatedLoads - Array of all isolated load names. 9 | % AllLoopedPairs - Array of all looped element names, by pairs. 10 | % BackwardBranch - Move back toward the source, return index of new active branch, or 0 if no more. 11 | % BranchName - Name of the active branch. 12 | % BusName - Set the active branch to one containing this bus, return index or 0 if not found 13 | % First - Sets the first branch active, returns 0 if none. 14 | % FirstLoad - First load at the active branch, return index or 0 if none. 15 | % ForwardBranch - Move forward in the tree, return index of new active branch or 0 if no more 16 | % LoopedBranch - Move to looped branch, return index or 0 if none. 17 | % Next - Sets the next branch active, returns 0 if no more. 18 | % NextLoad - Next load at the active branch, return index or 0 if no more. 19 | % NumIsolatedBranches - Number of isolated branches (PD elements and capacitors). 20 | % NumIsolatedLoads - Number of isolated loads 21 | % NumLoops - Number of loops 22 | % ParallelBranch - Move to directly parallel branch, return index or 0 if none. 23 | 24 | properties 25 | ActiveBranch 26 | ActiveLevel 27 | AllIsolatedBranches 28 | AllIsolatedLoads 29 | AllLoopedPairs 30 | BackwardBranch 31 | BranchName 32 | BusName 33 | First 34 | FirstLoad 35 | ForwardBranch 36 | LoopedBranch 37 | Next 38 | NextLoad 39 | NumIsolatedBranches 40 | NumIsolatedLoads 41 | NumLoops 42 | ParallelBranch 43 | end 44 | 45 | methods (Access = public) 46 | function obj = ITopology(apiutil) 47 | obj@DSS_MATLAB.Base(apiutil); 48 | end 49 | 50 | end 51 | methods 52 | 53 | function result = get.ActiveBranch(obj) 54 | % Returns index of the active branch 55 | result = calllib(obj.libname, 'ctx_Topology_Get_ActiveBranch', obj.dssctx); 56 | obj.CheckForError(); 57 | end 58 | 59 | function result = get.ActiveLevel(obj) 60 | % Topological depth of the active branch 61 | result = calllib(obj.libname, 'ctx_Topology_Get_ActiveLevel', obj.dssctx); 62 | obj.CheckForError(); 63 | end 64 | 65 | function result = get.AllIsolatedBranches(obj) 66 | % Array of all isolated branch names. 67 | result = obj.apiutil.get_string_array('ctx_Topology_Get_AllIsolatedBranches'); 68 | obj.CheckForError(); 69 | end 70 | 71 | function result = get.AllIsolatedLoads(obj) 72 | % Array of all isolated load names. 73 | result = obj.apiutil.get_string_array('ctx_Topology_Get_AllIsolatedLoads'); 74 | obj.CheckForError(); 75 | end 76 | 77 | function result = get.AllLoopedPairs(obj) 78 | % Array of all looped element names, by pairs. 79 | result = obj.apiutil.get_string_array('ctx_Topology_Get_AllLoopedPairs'); 80 | obj.CheckForError(); 81 | end 82 | 83 | function result = get.BackwardBranch(obj) 84 | % Move back toward the source, return index of new active branch, or 0 if no more. 85 | result = calllib(obj.libname, 'ctx_Topology_Get_BackwardBranch', obj.dssctx); 86 | obj.CheckForError(); 87 | end 88 | 89 | function result = get.BranchName(obj) 90 | % Name of the active branch. 91 | result = calllib(obj.libname, 'ctx_Topology_Get_BranchName', obj.dssctx); 92 | obj.CheckForError(); 93 | end 94 | function obj = set.BranchName(obj, Value) 95 | calllib(obj.libname, 'ctx_Topology_Set_BranchName', obj.dssctx, Value); 96 | obj.CheckForError(); 97 | end 98 | 99 | function result = get.BusName(obj) 100 | % Set the active branch to one containing this bus, return index or 0 if not found 101 | result = calllib(obj.libname, 'ctx_Topology_Get_BusName', obj.dssctx); 102 | obj.CheckForError(); 103 | end 104 | function obj = set.BusName(obj, Value) 105 | calllib(obj.libname, 'ctx_Topology_Set_BusName', obj.dssctx, Value); 106 | obj.CheckForError(); 107 | end 108 | 109 | function result = get.First(obj) 110 | % Sets the first branch active, returns 0 if none. 111 | result = calllib(obj.libname, 'ctx_Topology_Get_First', obj.dssctx); 112 | obj.CheckForError(); 113 | end 114 | 115 | function result = get.FirstLoad(obj) 116 | % First load at the active branch, return index or 0 if none. 117 | result = calllib(obj.libname, 'ctx_Topology_Get_FirstLoad', obj.dssctx); 118 | obj.CheckForError(); 119 | end 120 | 121 | function result = get.ForwardBranch(obj) 122 | % Move forward in the tree, return index of new active branch or 0 if no more 123 | result = calllib(obj.libname, 'ctx_Topology_Get_ForwardBranch', obj.dssctx); 124 | obj.CheckForError(); 125 | end 126 | 127 | function result = get.LoopedBranch(obj) 128 | % Move to looped branch, return index or 0 if none. 129 | result = calllib(obj.libname, 'ctx_Topology_Get_LoopedBranch', obj.dssctx); 130 | obj.CheckForError(); 131 | end 132 | 133 | function result = get.Next(obj) 134 | % Sets the next branch active, returns 0 if no more. 135 | result = calllib(obj.libname, 'ctx_Topology_Get_Next', obj.dssctx); 136 | obj.CheckForError(); 137 | end 138 | 139 | function result = get.NextLoad(obj) 140 | % Next load at the active branch, return index or 0 if no more. 141 | result = calllib(obj.libname, 'ctx_Topology_Get_NextLoad', obj.dssctx); 142 | obj.CheckForError(); 143 | end 144 | 145 | function result = get.NumIsolatedBranches(obj) 146 | % Number of isolated branches (PD elements and capacitors). 147 | result = calllib(obj.libname, 'ctx_Topology_Get_NumIsolatedBranches', obj.dssctx); 148 | obj.CheckForError(); 149 | end 150 | 151 | function result = get.NumIsolatedLoads(obj) 152 | % Number of isolated loads 153 | result = calllib(obj.libname, 'ctx_Topology_Get_NumIsolatedLoads', obj.dssctx); 154 | obj.CheckForError(); 155 | end 156 | 157 | function result = get.NumLoops(obj) 158 | % Number of loops 159 | result = calllib(obj.libname, 'ctx_Topology_Get_NumLoops', obj.dssctx); 160 | obj.CheckForError(); 161 | end 162 | 163 | function result = get.ParallelBranch(obj) 164 | % Move to directly parallel branch, return index or 0 if none. 165 | result = calllib(obj.libname, 'ctx_Topology_Get_ParallelBranch', obj.dssctx); 166 | obj.CheckForError(); 167 | end 168 | end 169 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IVsources.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IVsources < DSS_MATLAB.Base 2 | % IVsources: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all Vsource names 6 | % Count - Number of Vsource objects 7 | % First - Set first object of Vsource; returns 0 if none. 8 | % Name - Get/sets the name of the current active Vsource 9 | % Next - Sets next Vsource active; returns 0 if no more. 10 | % idx - Sets next Vsource active; returns 0 if no more. 11 | % AngleDeg - Phase angle of first phase in degrees 12 | % BasekV - Source voltage in kV 13 | % Frequency - Source frequency in Hz 14 | % Phases - Number of phases 15 | % pu - Per-unit value of source voltage 16 | 17 | properties 18 | AllNames 19 | Count 20 | First 21 | Name 22 | Next 23 | idx 24 | AngleDeg 25 | BasekV 26 | Frequency 27 | Phases 28 | pu 29 | end 30 | 31 | methods (Access = public) 32 | function obj = IVsources(apiutil) 33 | obj@DSS_MATLAB.Base(apiutil); 34 | end 35 | 36 | end 37 | methods 38 | 39 | function result = get.AllNames(obj) 40 | % Array of strings with all Vsource names 41 | result = obj.apiutil.get_string_array('ctx_Vsources_Get_AllNames'); 42 | end 43 | 44 | function result = get.Count(obj) 45 | % Number of Vsource objects 46 | result = calllib(obj.libname, 'ctx_Vsources_Get_Count', obj.dssctx); 47 | end 48 | 49 | function result = get.First(obj) 50 | % Set first object of Vsource; returns 0 if none. 51 | result = calllib(obj.libname, 'ctx_Vsources_Get_First', obj.dssctx); 52 | end 53 | 54 | function result = get.Name(obj) 55 | % Get/sets the name of the current active Vsource 56 | result = calllib(obj.libname, 'ctx_Vsources_Get_Name', obj.dssctx); 57 | end 58 | function obj = set.Name(obj, Value) 59 | calllib(obj.libname, 'ctx_Vsources_Set_Name', obj.dssctx, Value); 60 | obj.CheckForError(); 61 | end 62 | 63 | function result = get.Next(obj) 64 | % Sets next Vsource active; returns 0 if no more. 65 | result = calllib(obj.libname, 'ctx_Vsources_Get_Next', obj.dssctx); 66 | end 67 | 68 | function result = get.idx(obj) 69 | % Get/set active Vsource by index; 1..Count 70 | result = calllib(obj.libname, 'ctx_Vsources_Get_idx', obj.dssctx); 71 | end 72 | function obj = set.idx(obj, Value) 73 | calllib(obj.libname, 'ctx_Vsources_Set_idx', obj.dssctx, Value); 74 | obj.CheckForError(); 75 | end 76 | 77 | 78 | function result = get.AngleDeg(obj) 79 | % Phase angle of first phase in degrees 80 | result = calllib(obj.libname, 'ctx_Vsources_Get_AngleDeg', obj.dssctx); 81 | obj.CheckForError(); 82 | end 83 | function obj = set.AngleDeg(obj, Value) 84 | calllib(obj.libname, 'ctx_Vsources_Set_AngleDeg', obj.dssctx, Value); 85 | obj.CheckForError(); 86 | end 87 | 88 | function result = get.BasekV(obj) 89 | % Source voltage in kV 90 | result = calllib(obj.libname, 'ctx_Vsources_Get_BasekV', obj.dssctx); 91 | obj.CheckForError(); 92 | end 93 | function obj = set.BasekV(obj, Value) 94 | calllib(obj.libname, 'ctx_Vsources_Set_BasekV', obj.dssctx, Value); 95 | obj.CheckForError(); 96 | end 97 | 98 | function result = get.Frequency(obj) 99 | % Source frequency in Hz 100 | result = calllib(obj.libname, 'ctx_Vsources_Get_Frequency', obj.dssctx); 101 | obj.CheckForError(); 102 | end 103 | function obj = set.Frequency(obj, Value) 104 | calllib(obj.libname, 'ctx_Vsources_Set_Frequency', obj.dssctx, Value); 105 | obj.CheckForError(); 106 | end 107 | 108 | function result = get.Phases(obj) 109 | % Number of phases 110 | result = calllib(obj.libname, 'ctx_Vsources_Get_Phases', obj.dssctx); 111 | obj.CheckForError(); 112 | end 113 | function obj = set.Phases(obj, Value) 114 | calllib(obj.libname, 'ctx_Vsources_Set_Phases', obj.dssctx, Value); 115 | obj.CheckForError(); 116 | end 117 | 118 | function result = get.pu(obj) 119 | % Per-unit value of source voltage 120 | result = calllib(obj.libname, 'ctx_Vsources_Get_pu', obj.dssctx); 121 | obj.CheckForError(); 122 | end 123 | function obj = set.pu(obj, Value) 124 | calllib(obj.libname, 'ctx_Vsources_Set_pu', obj.dssctx, Value); 125 | obj.CheckForError(); 126 | end 127 | end 128 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IWireData.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IWireData < DSS_MATLAB.Base 2 | % IWireData: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all WireData names 6 | % Count - Number of WireData objects 7 | % First - Set first object of WireData; returns 0 if none. 8 | % Name - Get/sets the name of the current active WireData 9 | % Next - Sets next WireData active; returns 0 if no more. 10 | % idx - Sets next WireData active; returns 0 if no more. 11 | % EmergAmps - Emergency ampere rating 12 | % NormAmps - Normal Ampere rating 13 | % Rdc - 14 | % Rac - 15 | % GMRac - 16 | % GMRUnits - 17 | % Radius - 18 | % RadiusUnits - 19 | % ResistanceUnits - 20 | % Diameter - 21 | % CapRadius - Equivalent conductor radius for capacitance calcs. Specify this for bundled conductors. Defaults to same value as radius. 22 | 23 | properties 24 | AllNames 25 | Count 26 | First 27 | Name 28 | Next 29 | idx 30 | EmergAmps 31 | NormAmps 32 | Rdc 33 | Rac 34 | GMRac 35 | GMRUnits 36 | Radius 37 | RadiusUnits 38 | ResistanceUnits 39 | Diameter 40 | CapRadius 41 | end 42 | 43 | methods (Access = public) 44 | function obj = IWireData(apiutil) 45 | obj@DSS_MATLAB.Base(apiutil); 46 | end 47 | 48 | end 49 | methods 50 | 51 | function result = get.AllNames(obj) 52 | % Array of strings with all WireData names 53 | result = obj.apiutil.get_string_array('ctx_WireData_Get_AllNames'); 54 | end 55 | 56 | function result = get.Count(obj) 57 | % Number of WireData objects 58 | result = calllib(obj.libname, 'ctx_WireData_Get_Count', obj.dssctx); 59 | end 60 | 61 | function result = get.First(obj) 62 | % Set first object of WireData; returns 0 if none. 63 | result = calllib(obj.libname, 'ctx_WireData_Get_First', obj.dssctx); 64 | end 65 | 66 | function result = get.Name(obj) 67 | % Get/sets the name of the current active WireData 68 | result = calllib(obj.libname, 'ctx_WireData_Get_Name', obj.dssctx); 69 | end 70 | function obj = set.Name(obj, Value) 71 | calllib(obj.libname, 'ctx_WireData_Set_Name', obj.dssctx, Value); 72 | obj.CheckForError(); 73 | end 74 | 75 | function result = get.Next(obj) 76 | % Sets next WireData active; returns 0 if no more. 77 | result = calllib(obj.libname, 'ctx_WireData_Get_Next', obj.dssctx); 78 | end 79 | 80 | function result = get.idx(obj) 81 | % Get/set active WireData by index; 1..Count 82 | result = calllib(obj.libname, 'ctx_WireData_Get_idx', obj.dssctx); 83 | end 84 | function obj = set.idx(obj, Value) 85 | calllib(obj.libname, 'ctx_WireData_Set_idx', obj.dssctx, Value); 86 | obj.CheckForError(); 87 | end 88 | 89 | 90 | function result = get.EmergAmps(obj) 91 | % Emergency ampere rating 92 | result = calllib(obj.libname, 'ctx_WireData_Get_EmergAmps', obj.dssctx); 93 | obj.CheckForError(); 94 | end 95 | function obj = set.EmergAmps(obj, Value) 96 | calllib(obj.libname, 'ctx_WireData_Set_EmergAmps', obj.dssctx, Value); 97 | obj.CheckForError(); 98 | end 99 | 100 | function result = get.NormAmps(obj) 101 | % Normal Ampere rating 102 | result = calllib(obj.libname, 'ctx_WireData_Get_NormAmps', obj.dssctx); 103 | obj.CheckForError(); 104 | end 105 | function obj = set.NormAmps(obj, Value) 106 | calllib(obj.libname, 'ctx_WireData_Set_NormAmps', obj.dssctx, Value); 107 | obj.CheckForError(); 108 | end 109 | 110 | function result = get.Rdc(obj) 111 | result = calllib(obj.libname, 'ctx_WireData_Get_Rdc', obj.dssctx); 112 | obj.CheckForError(); 113 | end 114 | function obj = set.Rdc(obj, Value) 115 | calllib(obj.libname, 'ctx_WireData_Set_Rdc', obj.dssctx, Value); 116 | obj.CheckForError(); 117 | end 118 | 119 | function result = get.Rac(obj) 120 | result = calllib(obj.libname, 'ctx_WireData_Get_Rac', obj.dssctx); 121 | obj.CheckForError(); 122 | end 123 | function obj = set.Rac(obj, Value) 124 | calllib(obj.libname, 'ctx_WireData_Set_Rac', obj.dssctx, Value); 125 | obj.CheckForError(); 126 | end 127 | 128 | function result = get.GMRac(obj) 129 | result = calllib(obj.libname, 'ctx_WireData_Get_GMRac', obj.dssctx); 130 | obj.CheckForError(); 131 | end 132 | function obj = set.GMRac(obj, Value) 133 | calllib(obj.libname, 'ctx_WireData_Set_GMRac', obj.dssctx, Value); 134 | obj.CheckForError(); 135 | end 136 | 137 | function result = get.GMRUnits(obj) 138 | result = DSS_MATLAB.LineUnits(calllib(obj.libname, 'ctx_WireData_Get_GMRUnits', obj.dssctx)); 139 | obj.CheckForError(); 140 | end 141 | function obj = set.GMRUnits(obj, Value) 142 | calllib(obj.libname, 'ctx_WireData_Set_GMRUnits', obj.dssctx, Value); 143 | obj.CheckForError(); 144 | end 145 | 146 | function result = get.Radius(obj) 147 | result = calllib(obj.libname, 'ctx_WireData_Get_Radius', obj.dssctx); 148 | obj.CheckForError(); 149 | end 150 | function obj = set.Radius(obj, Value) 151 | calllib(obj.libname, 'ctx_WireData_Set_Radius', obj.dssctx, Value); 152 | obj.CheckForError(); 153 | end 154 | 155 | function result = get.RadiusUnits(obj) 156 | result = calllib(obj.libname, 'ctx_WireData_Get_RadiusUnits', obj.dssctx); 157 | obj.CheckForError(); 158 | end 159 | function obj = set.RadiusUnits(obj, Value) 160 | calllib(obj.libname, 'ctx_WireData_Set_RadiusUnits', obj.dssctx, Value); 161 | obj.CheckForError(); 162 | end 163 | 164 | function result = get.ResistanceUnits(obj) 165 | result = DSS_MATLAB.LineUnits(calllib(obj.libname, 'ctx_WireData_Get_ResistanceUnits', obj.dssctx)); 166 | obj.CheckForError(); 167 | end 168 | function obj = set.ResistanceUnits(obj, Value) 169 | calllib(obj.libname, 'ctx_WireData_Set_ResistanceUnits', obj.dssctx, Value); 170 | obj.CheckForError(); 171 | end 172 | 173 | function result = get.Diameter(obj) 174 | result = calllib(obj.libname, 'ctx_WireData_Get_Diameter', obj.dssctx); 175 | obj.CheckForError(); 176 | end 177 | function obj = set.Diameter(obj, Value) 178 | calllib(obj.libname, 'ctx_WireData_Set_Diameter', obj.dssctx, Value); 179 | obj.CheckForError(); 180 | end 181 | 182 | function result = get.CapRadius(obj) 183 | % Equivalent conductor radius for capacitance calcs. Specify this for bundled conductors. Defaults to same value as radius. 184 | result = calllib(obj.libname, 'ctx_WireData_Get_CapRadius', obj.dssctx); 185 | obj.CheckForError(); 186 | end 187 | function obj = set.CapRadius(obj, Value) 188 | calllib(obj.libname, 'ctx_WireData_Set_CapRadius', obj.dssctx, Value); 189 | obj.CheckForError(); 190 | end 191 | end 192 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IXYCurves.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IXYCurves < DSS_MATLAB.Base 2 | % IXYCurves: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % AllNames - Array of strings with all XYCurve names 6 | % Count - Number of XYCurve objects 7 | % First - Set first object of XYCurve; returns 0 if none. 8 | % Name - Get/sets the name of the current active XYCurve 9 | % Next - Sets next XYCurve active; returns 0 if no more. 10 | % idx - Sets next XYCurve active; returns 0 if no more. 11 | % Npts - Get/Set Number of points in X-Y curve 12 | % Xarray - Get/set X values as a Array of doubles. Set Npts to max number expected if setting 13 | % Xscale - Factor to scale X values from original curve 14 | % Xshift - Amount to shift X value from original curve 15 | % Yarray - Get/Set Y values in curve; Set Npts to max number expected if setting 16 | % Yscale - Factor to scale Y values from original curve 17 | % Yshift - Amount to shift Y value from original curve 18 | % x - Set X value or get interpolated value after setting Y 19 | % y - Set Y value or get interpolated Y value after setting X 20 | 21 | properties 22 | AllNames 23 | Count 24 | First 25 | Name 26 | Next 27 | idx 28 | Npts 29 | Xarray 30 | Xscale 31 | Xshift 32 | Yarray 33 | Yscale 34 | Yshift 35 | x 36 | y 37 | end 38 | 39 | methods (Access = public) 40 | function obj = IXYCurves(apiutil) 41 | obj@DSS_MATLAB.Base(apiutil); 42 | end 43 | 44 | end 45 | methods 46 | 47 | function result = get.AllNames(obj) 48 | % Array of strings with all XYCurve names 49 | result = obj.apiutil.get_string_array('ctx_XYCurves_Get_AllNames'); 50 | end 51 | 52 | function result = get.Count(obj) 53 | % Number of XYCurve objects 54 | result = calllib(obj.libname, 'ctx_XYCurves_Get_Count', obj.dssctx); 55 | end 56 | 57 | function result = get.First(obj) 58 | % Set first object of XYCurve; returns 0 if none. 59 | result = calllib(obj.libname, 'ctx_XYCurves_Get_First', obj.dssctx); 60 | end 61 | 62 | function result = get.Name(obj) 63 | % Get/sets the name of the current active XYCurve 64 | result = calllib(obj.libname, 'ctx_XYCurves_Get_Name', obj.dssctx); 65 | end 66 | function obj = set.Name(obj, Value) 67 | calllib(obj.libname, 'ctx_XYCurves_Set_Name', obj.dssctx, Value); 68 | obj.CheckForError(); 69 | end 70 | 71 | function result = get.Next(obj) 72 | % Sets next XYCurve active; returns 0 if no more. 73 | result = calllib(obj.libname, 'ctx_XYCurves_Get_Next', obj.dssctx); 74 | end 75 | 76 | function result = get.idx(obj) 77 | % Get/set active XYCurve by index; 1..Count 78 | result = calllib(obj.libname, 'ctx_XYCurves_Get_idx', obj.dssctx); 79 | end 80 | function obj = set.idx(obj, Value) 81 | calllib(obj.libname, 'ctx_XYCurves_Set_idx', obj.dssctx, Value); 82 | obj.CheckForError(); 83 | end 84 | 85 | 86 | function result = get.Npts(obj) 87 | % Get/Set Number of points in X-Y curve 88 | result = calllib(obj.libname, 'ctx_XYCurves_Get_Npts', obj.dssctx); 89 | obj.CheckForError(); 90 | end 91 | function obj = set.Npts(obj, Value) 92 | calllib(obj.libname, 'ctx_XYCurves_Set_Npts', obj.dssctx, Value); 93 | obj.CheckForError(); 94 | end 95 | 96 | function result = get.Xarray(obj) 97 | % Get/set X values as a Array of doubles. Set Npts to max number expected if setting 98 | calllib(obj.libname, 'ctx_XYCurves_Get_Xarray_GR', obj.dssctx); 99 | obj.CheckForError(); 100 | result = obj.apiutil.get_float64_gr_array(); 101 | end 102 | function obj = set.Xarray(obj, Value) 103 | calllib(obj.libname, 'ctx_XYCurves_Set_Xarray', obj.dssctx, Value, numel(Value)); 104 | obj.CheckForError(); 105 | end 106 | 107 | function result = get.Xscale(obj) 108 | % Factor to scale X values from original curve 109 | result = calllib(obj.libname, 'ctx_XYCurves_Get_Xscale', obj.dssctx); 110 | obj.CheckForError(); 111 | end 112 | function obj = set.Xscale(obj, Value) 113 | calllib(obj.libname, 'ctx_XYCurves_Set_Xscale', obj.dssctx, Value); 114 | obj.CheckForError(); 115 | end 116 | 117 | function result = get.Xshift(obj) 118 | % Amount to shift X value from original curve 119 | result = calllib(obj.libname, 'ctx_XYCurves_Get_Xshift', obj.dssctx); 120 | obj.CheckForError(); 121 | end 122 | function obj = set.Xshift(obj, Value) 123 | calllib(obj.libname, 'ctx_XYCurves_Set_Xshift', obj.dssctx, Value); 124 | obj.CheckForError(); 125 | end 126 | 127 | function result = get.Yarray(obj) 128 | % Get/Set Y values in curve; Set Npts to max number expected if setting 129 | calllib(obj.libname, 'ctx_XYCurves_Get_Yarray_GR', obj.dssctx); 130 | obj.CheckForError(); 131 | result = obj.apiutil.get_float64_gr_array(); 132 | end 133 | function obj = set.Yarray(obj, Value) 134 | calllib(obj.libname, 'ctx_XYCurves_Set_Yarray', obj.dssctx, Value, numel(Value)); 135 | obj.CheckForError(); 136 | end 137 | 138 | function result = get.Yscale(obj) 139 | % Factor to scale Y values from original curve 140 | result = calllib(obj.libname, 'ctx_XYCurves_Get_Yscale', obj.dssctx); 141 | obj.CheckForError(); 142 | end 143 | function obj = set.Yscale(obj, Value) 144 | calllib(obj.libname, 'ctx_XYCurves_Set_Yscale', obj.dssctx, Value); 145 | obj.CheckForError(); 146 | end 147 | 148 | function result = get.Yshift(obj) 149 | % Amount to shift Y value from original curve 150 | result = calllib(obj.libname, 'ctx_XYCurves_Get_Yshift', obj.dssctx); 151 | obj.CheckForError(); 152 | end 153 | function obj = set.Yshift(obj, Value) 154 | calllib(obj.libname, 'ctx_XYCurves_Set_Yshift', obj.dssctx, Value); 155 | obj.CheckForError(); 156 | end 157 | 158 | function result = get.x(obj) 159 | % Set X value or get interpolated value after setting Y 160 | result = calllib(obj.libname, 'ctx_XYCurves_Get_x', obj.dssctx); 161 | obj.CheckForError(); 162 | end 163 | function obj = set.x(obj, Value) 164 | calllib(obj.libname, 'ctx_XYCurves_Set_x', obj.dssctx, Value); 165 | obj.CheckForError(); 166 | end 167 | 168 | function result = get.y(obj) 169 | % Set Y value or get interpolated Y value after setting X 170 | result = calllib(obj.libname, 'ctx_XYCurves_Get_y', obj.dssctx); 171 | obj.CheckForError(); 172 | end 173 | function obj = set.y(obj, Value) 174 | calllib(obj.libname, 'ctx_XYCurves_Set_y', obj.dssctx, Value); 175 | obj.CheckForError(); 176 | end 177 | end 178 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IYMatrix.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IYMatrix < DSS_MATLAB.Base 2 | % IYMatrix: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Properties: 5 | % SystemYChanged - 6 | % UseAuxCurrents - 7 | % 8 | % Methods: 9 | % GetCompressedYMatrix - Returns the circuit's YMatrix as a sparse MATLAB matrix 10 | % ZeroInjCurr - 11 | % GetSourceInjCurrents - 12 | % GetPCInjCurr - 13 | % BuildYMatrixD - 14 | % AddInAuxCurrents - 15 | % GetIPointer - Get access to the internal Current pointer 16 | % GetVPointer - Get access to the internal Voltage pointer 17 | % SolveSystem - 18 | % getI - Get the data from the internal Current pointer 19 | % getV - Get the data from the internal Voltage pointer 20 | 21 | properties 22 | SystemYChanged 23 | UseAuxCurrents 24 | end 25 | 26 | methods (Access = public) 27 | function obj = IYMatrix(apiutil) 28 | obj@DSS_MATLAB.Base(apiutil); 29 | end 30 | 31 | function result = GetCompressedYMatrix(obj, factor) 32 | % Returns the circuit's YMatrix as a sparse MATLAB matrix 33 | if (nargin < 2) 34 | factor = 0; 35 | end 36 | 37 | nBus = libpointer('uint32Ptr', 0); 38 | nNz = libpointer('uint32Ptr', 0); 39 | ColPtr = libpointer('int32PtrPtr'); 40 | RowIdxPtr = libpointer('int32PtrPtr'); 41 | cValsPtr = libpointer('doublePtrPtr'); 42 | calllib(obj.libname, 'ctx_YMatrix_GetCompressedYMatrix', obj.dssctx, factor, nBus, nNz, ColPtr, RowIdxPtr, cValsPtr); 43 | obj.CheckForError; 44 | if ((~nBus.Value(1) || ~nNz.Value(1))) 45 | result = 0; 46 | return 47 | else 48 | setdatatype(ColPtr.Value, 'int32Ptr', 1, nBus.Value(1) + 1); 49 | setdatatype(RowIdxPtr.Value, 'int32Ptr', 1, nNz.Value(1)); 50 | setdatatype(cValsPtr.Value, 'doublePtr', 1, nNz.Value(1) * 2); 51 | vals = cValsPtr.Value(1:2:end) + 1j * cValsPtr.Value(2:2:end); 52 | 53 | % We need to decompress the columns 54 | ColPtrValues = ColPtr.Value + 1; 55 | cols = zeros(1, nNz.Value(1)); 56 | for col=1:nBus.Value(1) 57 | cols(ColPtrValues(col):ColPtrValues(col+1)-1) = col; 58 | end 59 | 60 | result = sparse(double(RowIdxPtr.Value) + 1, cols, vals); 61 | calllib(obj.libname, 'DSS_Dispose_PInteger', ColPtr); 62 | calllib(obj.libname, 'DSS_Dispose_PInteger', RowIdxPtr); 63 | calllib(obj.libname, 'DSS_Dispose_PDouble', cValsPtr); 64 | end 65 | end 66 | 67 | function obj = ZeroInjCurr(obj) 68 | calllib(obj.libname, 'ctx_YMatrix_ZeroInjCurr', obj.dssctx); 69 | end 70 | 71 | function obj = GetSourceInjCurrents(obj) 72 | calllib(obj.libname, 'ctx_YMatrix_GetSourceInjCurrents', obj.dssctx); 73 | end 74 | 75 | function obj = GetPCInjCurr(obj) 76 | calllib(obj.libname, 'ctx_YMatrix_GetPCInjCurr', obj.dssctx); 77 | end 78 | 79 | function obj = BuildYMatrixD(obj, BuildOps, AllocateVI) 80 | calllib(obj.libname, 'ctx_YMatrix_BuildYMatrixD', obj.dssctx, BuildOps, AllocateVI); 81 | end 82 | 83 | function obj = AddInAuxCurrents(obj, SType) 84 | calllib(obj.libname, 'ctx_YMatrix_AddInAuxCurrents', obj.dssctx, SType); 85 | end 86 | 87 | function result = GetIPointer(obj) 88 | % Get access to the internal Current pointer 89 | IvectorPtr = libpointer('doublePtrPtr'); 90 | numNodes = (calllib(obj.libname, 'ctx_Circuit_Get_NumNodes', obj.dssctx) + 1) * 2; 91 | calllib(obj.libname, 'ctx_YMatrix_getIpointer', obj.dssctx, IvectorPtr); 92 | setdatatype(IvectorPtr.Value, 'doublePtr', 1, numNodes); 93 | result = IvectorPtr; 94 | end 95 | 96 | function result = GetVPointer(obj) 97 | % Get access to the internal Voltage pointer 98 | VvectorPtr = libpointer('doublePtrPtr'); 99 | numNodes = (calllib(obj.libname, 'ctx_Circuit_Get_NumNodes', obj.dssctx) + 1) * 2; 100 | calllib(obj.libname, 'ctx_YMatrix_getVpointer', obj.dssctx, VvectorPtr); 101 | setdatatype(VvectorPtr.Value, 'doublePtr', 1, numNodes); 102 | result = VvectorPtr; 103 | end 104 | 105 | function result = SolveSystem(obj, NodeV) 106 | result = calllib(obj.libname, 'ctx_YMatrix_SolveSystem', obj.dssctx, NodeV); 107 | obj.CheckForError(); 108 | end 109 | 110 | function result = getYSparse(obj) 111 | result = obj.GetCompressedYMatrix; 112 | end 113 | 114 | function result = getI(obj) 115 | % Get the data from the internal Current pointer 116 | result = obj.IPointer.Value; 117 | end 118 | 119 | function result = getV(obj) 120 | % Get the data from the internal Voltage pointer 121 | result = obj.VPointer.Value; 122 | end 123 | end 124 | 125 | methods 126 | 127 | function result = get.SystemYChanged(obj) 128 | result = calllib(obj.libname, 'ctx_YMatrix_Get_SystemYChanged', obj.dssctx) ~= 0; 129 | end 130 | function obj = set.SystemYChanged(obj, value) 131 | calllib(obj.libname, 'ctx_YMatrix_Set_SystemYChanged', obj.dssctx, value); 132 | obj.CheckForError(); 133 | end 134 | 135 | function result = get.UseAuxCurrents(obj) 136 | result = calllib(obj.libname, 'ctx_YMatrix_Get_UseAuxCurrents', obj.dssctx) ~= 0; 137 | end 138 | function obj = set.UseAuxCurrents(obj, value) 139 | calllib(obj.libname, 'ctx_YMatrix_Set_UseAuxCurrents', obj.dssctx, value); 140 | obj.CheckForError(); 141 | end 142 | 143 | end 144 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/IZIP.m: -------------------------------------------------------------------------------- 1 | classdef (CaseInsensitiveProperties) IZIP < DSS_MATLAB.Base 2 | % IZIP: DSS MATLAB interface class to DSS C-API 3 | % 4 | % Methods: 5 | % Open - Opens and prepares a ZIP file to be used by the DSS text parser. Currently, the ZIP format support is limited by what is provided in the Free Pascal distribution. Besides that, the full filenames inside the ZIP must be shorter than 256 characters. The limitations should be removed in a future revision. (API Extension) 6 | % Close - Closes the current open ZIP file (API Extension) 7 | % Redirect - Runs a "Redirect" command inside the current (open) ZIP file. In the current implementation, all files required by the script must be present inside the ZIP, using relative paths. The only exceptions are memory-mapped files. (API Extension) 8 | % Extract - Extracts the contents of the file "FileName" from the current (open) ZIP file. Returns a byte-string. (API Extension) 9 | % List - List of strings consisting of all names match the regular expression provided in regexp. If no expression is provided, all names in the current open ZIP are returned. See https://regex.sorokin.engineer/en/latest/regular_expressions.html for information on the expression syntax and options. (API Extension) 10 | % Contains - Check if the given path name is present in the current ZIP file. (API Extension) 11 | 12 | methods (Access = public) 13 | function obj = IZIP(apiutil) 14 | obj@DSS_MATLAB.Base(apiutil); 15 | end 16 | 17 | function obj = Open(obj, FileName) 18 | % Opens and prepares a ZIP file to be used by the DSS text parser. 19 | % Currently, the ZIP format support is limited by what is provided in the Free Pascal distribution. 20 | % Besides that, the full filenames inside the ZIP must be shorter than 256 characters. 21 | % The limitations should be removed in a future revision. 22 | % 23 | % (API Extension) 24 | calllib(obj.libname, 'ctx_ZIP_Open', obj.dssctx, FileName); 25 | obj.CheckForError(); 26 | end 27 | 28 | function obj = Close(obj) 29 | % Closes the current open ZIP file 30 | % 31 | % (API Extension) 32 | calllib(obj.libname, 'ctx_ZIP_Close', obj.dssctx); 33 | obj.CheckForError(); 34 | end 35 | 36 | function obj = Redirect(obj, FileInZip) 37 | % Runs a "Redirect" command inside the current (open) ZIP file. 38 | % In the current implementation, all files required by the script must 39 | % be present inside the ZIP, using relative paths. The only exceptions are 40 | % memory-mapped files. 41 | % 42 | % (API Extension) 43 | calllib(obj.libname, 'ctx_ZIP_Redirect', obj.dssctx, FileInZip); 44 | obj.CheckForError(); 45 | end 46 | 47 | function result = Extract(obj, FileName) 48 | % Extracts the contents of the file "FileName" from the current (open) ZIP file. 49 | % Returns a byte-string. 50 | % 51 | % (API Extension) 52 | calllib(obj.libname, 'ctx_ZIP_Extract_GR', obj.dssctx, FileName); 53 | obj.CheckForError(); 54 | result = obj.apiutil.get_int8_gr_array(); 55 | end 56 | 57 | function result = List(obj, regexp) 58 | % List of strings consisting of all names match the regular expression provided in regexp. 59 | % If no expression is provided, all names in the current open ZIP are returned. 60 | % 61 | % See https://regex.sorokin.engineer/en/latest/regular_expressions.html for information on 62 | % the expression syntax and options. 63 | % 64 | % (API Extension) 65 | if ~exist('regexp', 'var') 66 | regexp = []; 67 | end 68 | result = obj.apiutil.get_string_array('ctx_ZIP_List', regexp); 69 | obj.CheckForError(); 70 | end 71 | 72 | function result = Contains(obj, Name) 73 | % Check if the given path name is present in the current ZIP file. 74 | % 75 | % (API Extension) 76 | result = (calllib(obj.libname, 'ctx_ZIP_Contains', obj.dssctx, Name) ~= 0); 77 | obj.CheckForError(); 78 | end 79 | end 80 | methods 81 | 82 | end 83 | end -------------------------------------------------------------------------------- /+DSS_MATLAB/LineUnits.m: -------------------------------------------------------------------------------- 1 | classdef(Enumeration) LineUnits < int32 2 | % LineUnits: enumerated values for dimensions in various objects 3 | % 4 | % Values: 5 | # none(0): No line length unit 6 | # Miles(1): Line length units in miles 7 | # kFt(2): Line length units are in thousand feet 8 | # km(3): Line length units are km 9 | # meter(4): Line length units are meters 10 | # ft(5): Line units in feet 11 | # inch(6): Line length units are inches 12 | # cm(7): Line units are cm 13 | # mm(8): Line length units are mm 14 | 15 | enumeration 16 | none(0) % No line length unit 17 | Miles(1) % Line length units in miles 18 | kFt(2) % Line length units are in thousand feet 19 | km(3) % Line length units are km 20 | meter(4) % Line length units are meters 21 | ft(5) % Line units in feet 22 | inch(6) % Line length units are inches 23 | cm(7) % Line units are cm 24 | mm(8) % Line length units are mm 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /+DSS_MATLAB/LoadStatus.m: -------------------------------------------------------------------------------- 1 | classdef(Enumeration) LoadStatus < int32 2 | % LoadStatus: enumerated values for Loads.Status 3 | % 4 | % 5 | % Values: 6 | % Variable(0) 7 | % Fixed(1) 8 | % Exempt(2) 9 | 10 | enumeration 11 | Variable(0) 12 | Fixed(1) 13 | Exempt(2) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /+DSS_MATLAB/OCPDevTypes.m: -------------------------------------------------------------------------------- 1 | classdef(Enumeration) OCPDevTypes < int32 2 | % OCPDevTypes: enumerated values for DSS.ActiveCktElement.OCPDevType 3 | % 4 | % Values: 5 | % none(0) 6 | % Fuse(1) 7 | % Recloser(2) 8 | % Relay(3) 9 | 10 | enumeration 11 | none(0) 12 | Fuse(1) 13 | Recloser(2) 14 | Relay(3) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /+DSS_MATLAB/SolutionAlgorithms.m: -------------------------------------------------------------------------------- 1 | classdef(Enumeration) SolutionAlgorithms < int32 2 | % SolutionAlgorithms: enumerated values for DSS.Solution.Algorithm 3 | % 4 | % Values: 5 | % NormalSolve(0): Solution algorithm option - Normal solution 6 | % NewtonSolve(1): Solution algorithm option - Newton solution 7 | 8 | enumeration 9 | NormalSolve(0) % Solution algorithm option - Normal solution 10 | NewtonSolve(1) % Solution algorithm option - Newton solution 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /+DSS_MATLAB/SolveModes.m: -------------------------------------------------------------------------------- 1 | classdef(Enumeration) SolveModes < int32 2 | % SolveModes: enumerated values for DSS.Solution.Mode 3 | % 4 | % Values: 5 | % SnapShot(0): Solve a single snapshot power flow 6 | % Daily(1): Solve following Daily load shapes 7 | % Yearly(2): Solve following Yearly load shapes 8 | % Monte1(3): Monte Carlo Mode 1 9 | % LD1(4): Load-duration Mode 1 10 | % PeakDay(5): Solves for Peak Day using Daily load curve 11 | % DutyCycle(6): Solve following Duty Cycle load shapes 12 | % Direct(7): Solve direct (forced admittance model) 13 | % MonteFault(8): Monte carlo Fault Study 14 | % FaultStudy(9): Fault study at all buses 15 | % Monte2(10): Monte Carlo Mode 2 16 | % Monte3(11): Monte Carlo Mode 3 17 | % LD2(12): Load-Duration Mode 2 18 | % AutoAdd(13): Auto add generators or capacitors 19 | % Dynamic(14): Solve for dynamics 20 | % Harmonic(15): Harmonic solution mode 21 | % Time(16) 22 | % HarmonicT(17) 23 | 24 | enumeration 25 | SnapShot(0) % Solve a single snapshot power flow 26 | Daily(1) % Solve following Daily load shapes 27 | Yearly(2) % Solve following Yearly load shapes 28 | Monte1(3) % Monte Carlo Mode 1 29 | LD1(4) % Load-duration Mode 1 30 | PeakDay(5) % Solves for Peak Day using Daily load curve 31 | DutyCycle(6) % Solve following Duty Cycle load shapes 32 | Direct(7) % Solve direct (forced admittance model) 33 | MonteFault(8) % Monte carlo Fault Study 34 | FaultStudy(9) % Fault study at all buses 35 | Monte2(10) % Monte Carlo Mode 2 36 | Monte3(11) % Monte Carlo Mode 3 37 | LD2(12) % Load-Duration Mode 2 38 | AutoAdd(13) % Auto add generators or capacitors 39 | Dynamic(14) % Solve for dynamics 40 | Harmonic(15) % Harmonic solution mode 41 | Time(16) 42 | HarmonicT(17) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /+DSS_MATLAB/build_thunk.m.disabled: -------------------------------------------------------------------------------- 1 | % This script builds the thunk DLL file for DSS_MATLAB. 2 | % Since the performance is nearly the same without it, 3 | % this is disabled 4 | 5 | original_folder = pwd; 6 | try 7 | MfilePath = fileparts(mfilename('fullpath')); 8 | 9 | if libisloaded('dss_capi') 10 | unloadlibrary('dss_capi'); 11 | end 12 | 13 | cd(MfilePath); 14 | DLLfilePath = fullfile(MfilePath, 'dss_capi'); 15 | try 16 | loadlibrary(DLLfilePath, 'dss_capi.h', 'mfilename', 'dss_capi'); 17 | catch err 18 | % ignored 19 | end 20 | 21 | loadlibrary(DLLfilePath, @DSS_MATLAB.dss_capi); 22 | disp('Thunk file for DSS_MATLAB was build successfully!'); 23 | 24 | catch err 25 | cd(original_folder); 26 | rethrow(err); 27 | end 28 | -------------------------------------------------------------------------------- /+DSS_MATLAB/ctxrefcount.m: -------------------------------------------------------------------------------- 1 | function out = ctxrefcount(ctx, data) 2 | persistent refcountmap; 3 | if isempty(refcountmap) 4 | refcountmap = containers.Map('KeyType','uint64','ValueType','int32'); 5 | end 6 | refcount = 0; 7 | if isKey(refcountmap, ctx) 8 | refcount = refcountmap(ctx); 9 | end 10 | if data > 0 11 | refcount = refcount + 1; 12 | end 13 | if data < 0 14 | refcount = refcount - 1; 15 | end 16 | refcountmap(ctx) = refcount; 17 | out = refcount; 18 | end 19 | -------------------------------------------------------------------------------- /+DSS_MATLAB/librefcount.m: -------------------------------------------------------------------------------- 1 | function out = librefcount(data) 2 | persistent refcount; 3 | if isempty(refcount) 4 | refcount = 0; 5 | end 6 | if data > 0 7 | refcount = refcount + 1; 8 | end 9 | if data < 0 10 | refcount = refcount - 1; 11 | end 12 | out = refcount; 13 | end 14 | -------------------------------------------------------------------------------- /+DSS_MATLAB/version.m: -------------------------------------------------------------------------------- 1 | function result = version 2 | result = '0.14.3-1'; 3 | end -------------------------------------------------------------------------------- /.github/workflows/builds.yml: -------------------------------------------------------------------------------- 1 | name: "Build packages" 2 | 3 | on: 4 | # release: 5 | # types: [created] 6 | push: 7 | 8 | env: 9 | DSS_CAPI_VERSION: '0.14.3' 10 | DSS_MATLAB_VERSION: '0.14.3-1' 11 | 12 | jobs: 13 | linux_x64: 14 | runs-on: ubuntu-latest 15 | env: 16 | TRAVIS_JOB_NAME: "linux_x64" 17 | steps: 18 | - name: Install requirements 19 | run: | 20 | sudo apt-get install patchelf 21 | - name: 'Checkout' 22 | run: | 23 | git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY dss_matlab 24 | cd dss_matlab 25 | git checkout $GITHUB_SHA 26 | - name: Package 27 | run: | 28 | cd dss_matlab 29 | wget "https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_VERSION}/dss_capi_${DSS_CAPI_VERSION}_${TRAVIS_JOB_NAME}.tar.gz" -Odss_capi.tar.gz -q 30 | tar zxf dss_capi.tar.gz 31 | wget "https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_VERSION}/messages.tar.gz" -Omessages.tar.gz -q 32 | tar zxf messages.tar.gz 33 | mkdir -p release/dss_matlab 34 | cp -R "+DSS_MATLAB" "release/dss_matlab/+DSS_MATLAB" 35 | mv messages "release/dss_matlab/+DSS_MATLAB/" 36 | mv dss_capi/lib/${TRAVIS_JOB_NAME}/libdss_capi.so "release/dss_matlab/+DSS_MATLAB/dss_capi.so" 37 | mv dss_capi/lib/${TRAVIS_JOB_NAME}/libdss_capid.so "release/dss_matlab/+DSS_MATLAB/dss_capid.so" 38 | mv dss_capi/lib/${TRAVIS_JOB_NAME}/libklusolvex.so "release/dss_matlab/+DSS_MATLAB/" 39 | mv dss_capi/LICENSE "release/dss_matlab/DSS_C-API_LICENSE" 40 | mv dss_capi/*LICENSE "release/dss_matlab/" 41 | mv LICENSE release/dss_matlab/ 42 | mv README.md release/dss_matlab/ 43 | mv examples release/dss_matlab/ 44 | cd "release/dss_matlab/+DSS_MATLAB" 45 | patchelf --set-rpath '$ORIGIN/.' dss_capi.so 46 | patchelf --set-rpath '$ORIGIN/.' dss_capid.so 47 | cd ../.. 48 | tar zcf dss_matlab_v${DSS_MATLAB_VERSION}_${TRAVIS_JOB_NAME}.tar.gz dss_matlab 49 | rm -rf dss_matlab 50 | ls -l 51 | cd .. 52 | - name: 'Upload artifacts' 53 | uses: "actions/upload-artifact@v4" 54 | with: 55 | name: 'package-linux_x64' 56 | path: '${{ github.workspace }}/dss_matlab/release' 57 | 58 | win_x64: 59 | runs-on: ubuntu-latest 60 | env: 61 | TRAVIS_JOB_NAME: "win_x64" 62 | steps: 63 | - name: 'Checkout' 64 | run: | 65 | git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY dss_matlab 66 | cd dss_matlab 67 | git checkout $GITHUB_SHA 68 | - name: Package 69 | run: | 70 | cd dss_matlab 71 | wget "https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_VERSION}/dss_capi_${DSS_CAPI_VERSION}_${TRAVIS_JOB_NAME}.zip" -Odss_capi.zip -q 72 | unzip dss_capi.zip 73 | wget "https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_VERSION}/messages.tar.gz" -Omessages.tar.gz -q 74 | tar zxf messages.tar.gz 75 | rm -f dss_capi/lib/${TRAVIS_JOB_NAME}/*_v8.dll 76 | mkdir -p release/dss_matlab 77 | cp -R "+DSS_MATLAB" "release/dss_matlab/+DSS_MATLAB" 78 | mv messages "release/dss_matlab/+DSS_MATLAB/" 79 | mv dss_capi/lib/${TRAVIS_JOB_NAME}/*.dll "release/dss_matlab/+DSS_MATLAB/" 80 | mv dss_capi/LICENSE "release/dss_matlab/DSS_C-API_LICENSE" 81 | mv dss_capi/*LICENSE "release/dss_matlab/" 82 | mv LICENSE release/dss_matlab/ 83 | mv README.md release/dss_matlab/ 84 | mv examples release/dss_matlab/ 85 | cd release 86 | zip -r dss_matlab_v${DSS_MATLAB_VERSION}_${TRAVIS_JOB_NAME}.zip dss_matlab 87 | rm -rf dss_matlab 88 | ls -l 89 | cd .. 90 | - name: 'Upload artifacts' 91 | uses: "actions/upload-artifact@v4" 92 | with: 93 | name: 'package-win_x64' 94 | path: '${{ github.workspace }}/dss_matlab/release' 95 | 96 | darwin_x64: 97 | runs-on: 'macos-13' 98 | env: 99 | TRAVIS_JOB_NAME: "darwin_x64" 100 | steps: 101 | - name: 'Checkout' 102 | run: | 103 | git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY dss_matlab 104 | cd dss_matlab 105 | git checkout $GITHUB_SHA 106 | - name: Package 107 | run: | 108 | cd dss_matlab 109 | wget "https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_VERSION}/dss_capi_${DSS_CAPI_VERSION}_${TRAVIS_JOB_NAME}.tar.gz" -Odss_capi.tar.gz -q 110 | tar zxf dss_capi.tar.gz 111 | wget "https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_VERSION}/messages.tar.gz" -Omessages.tar.gz -q 112 | tar zxf messages.tar.gz 113 | mkdir -p release/dss_matlab 114 | cp -R "+DSS_MATLAB" "release/dss_matlab/+DSS_MATLAB" 115 | mv messages "release/dss_matlab/+DSS_MATLAB/" 116 | mv dss_capi/lib/${TRAVIS_JOB_NAME}/libdss_capi.dylib "release/dss_matlab/+DSS_MATLAB/dss_capi.dylib" 117 | mv dss_capi/lib/${TRAVIS_JOB_NAME}/libdss_capid.dylib "release/dss_matlab/+DSS_MATLAB/dss_capid.dylib" 118 | mv dss_capi/lib/${TRAVIS_JOB_NAME}/libklusolvex.dylib "release/dss_matlab/+DSS_MATLAB/" 119 | mv dss_capi/LICENSE "release/dss_matlab/DSS_C-API_LICENSE" 120 | mv dss_capi/*LICENSE "release/dss_matlab/" 121 | mv LICENSE release/dss_matlab/ 122 | mv README.md release/dss_matlab/ 123 | mv examples release/dss_matlab/ 124 | cd release 125 | tar zcf dss_matlab_v${DSS_MATLAB_VERSION}_macos_x64.tar.gz dss_matlab 126 | rm -rf dss_matlab 127 | ls -l 128 | cd .. 129 | - name: 'Upload artifacts' 130 | uses: "actions/upload-artifact@v4" 131 | with: 132 | name: 'package-darwin_x64' 133 | path: '${{ github.workspace }}/dss_matlab/release' 134 | 135 | darwin_arm64: 136 | runs-on: 'macos-13' 137 | env: 138 | TRAVIS_JOB_NAME: "darwin_arm64" 139 | steps: 140 | - name: 'Checkout' 141 | run: | 142 | git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY dss_matlab 143 | cd dss_matlab 144 | git checkout $GITHUB_SHA 145 | - name: Package 146 | run: | 147 | cd dss_matlab 148 | wget "https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_VERSION}/dss_capi_${DSS_CAPI_VERSION}_${TRAVIS_JOB_NAME}.tar.gz" -Odss_capi.tar.gz -q 149 | tar zxf dss_capi.tar.gz 150 | wget "https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_VERSION}/messages.tar.gz" -Omessages.tar.gz -q 151 | tar zxf messages.tar.gz 152 | mkdir -p release/dss_matlab 153 | cp -R "+DSS_MATLAB" "release/dss_matlab/+DSS_MATLAB" 154 | mv messages "release/dss_matlab/+DSS_MATLAB/" 155 | mv dss_capi/lib/${TRAVIS_JOB_NAME}/libdss_capi.dylib "release/dss_matlab/+DSS_MATLAB/dss_capi.dylib" 156 | mv dss_capi/lib/${TRAVIS_JOB_NAME}/libdss_capid.dylib "release/dss_matlab/+DSS_MATLAB/dss_capid.dylib" 157 | mv dss_capi/lib/${TRAVIS_JOB_NAME}/libklusolvex.dylib "release/dss_matlab/+DSS_MATLAB/" 158 | mv dss_capi/LICENSE "release/dss_matlab/DSS_C-API_LICENSE" 159 | mv dss_capi/*LICENSE "release/dss_matlab/" 160 | mv LICENSE release/dss_matlab/ 161 | mv README.md release/dss_matlab/ 162 | mv examples release/dss_matlab/ 163 | cd release 164 | tar zcf dss_matlab_v${DSS_MATLAB_VERSION}_macos_arm64.tar.gz dss_matlab 165 | rm -rf dss_matlab 166 | ls -l 167 | cd .. 168 | - name: 'Upload artifacts' 169 | uses: "actions/upload-artifact@v4" 170 | with: 171 | name: 'package-darwin_arm64' 172 | path: '${{ github.workspace }}/dss_matlab/release' 173 | 174 | 175 | merge: 176 | runs-on: ubuntu-latest 177 | needs: [linux_x64, win_x64, darwin_x64, darwin_arm64] 178 | steps: 179 | - name: Merge Artifacts 180 | uses: actions/upload-artifact/merge@v4 181 | with: 182 | name: 'dss_matlab-packages' 183 | pattern: '*' 184 | delete-merged: true 185 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018-2022, Paulo Meira 4 | Copyright (c) 2018-2022, DSS Extensions contributors 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name of the copyright holder nor the names of its 18 | contributors may be used to endorse or promote products derived from 19 | this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 25 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DSS MATLAB: a multi-platform MATLAB package for DSS C-API, an alternative implementation of EPRI's OpenDSS 2 | 3 | --- 4 | 5 | ## **[📦 Downloads available here](https://github.com/dss-extensions/dss_matlab/releases/latest) for Linux, macOS and Windows** 6 | 7 | *Note that the repository itself doesn't contain the binaries since this is a multi-platform project. If you download the Git repository, you still need the binary files from the DSS C-API library.* Please head on to the Releases page for downloads. 8 | 9 | --- 10 | 11 | This is version of a set of MATLAB classes that expose the DSS C-API library with the same structure as the COM object, with the same extensions as DSS Python. This is the equivalent of DSS-Python and DSS-Sharp for MATLAB usage. 12 | 13 | Please see [https://dss-extensions.org/](https://dss-extensions.org/) for a general introduction and useful links for all projects under DSS Extensions. 14 | 15 | A new repository to coordinate documentation and other shared features across all DSS Extensions is now available at [https://github.com/dss-extensions/dss-extensions](https://github.com/dss-extensions/dss-extensions) 16 | 17 | Related projects: 18 | - [`OpenDSS`](https://sourceforge.net/projects/electricdss/): The main OpenDSS project, maintained by EPRI. We track the changes there and port accordingly, with a few exceptions. 19 | - [`DSS C-API`](http://github.com/dss-extensions/dss_capi): Custom OpenDSS C-API library (a.k.a. AltDSS), which also includes customize code and extra features, maintaining very good compatibility. 20 | - [dss.hpp](https://dss-extensions.org/dss_capi/): header-only library for C++, hosted within DSS C-API (`include/` directory). Allows using DSS C-API more comfortably from C++, abstract memory management and low-level details such as API conventions of the DSS C-API library. 21 | - [`DSS-Python`](http://github.com/dss-extensions/dss_python): Python bindings that mimics the official COM interface (property-style access to items). Very similar to DSS_MATLAB, but for Python. Some new and experimental features are tested there first (for example, plotting integration). 22 | - [`OpenDSSDirect.py`](http://github.com/dss-extensions/OpenDSSDirect.py): Function-style bindings and useful tools (originally based on the DCSL/OpenDSSDirect.DLL). 23 | - [`OpenDSSDirect.jl`](http://github.com/dss-extensions/OpenDSSDirect.jl): Julia bindings to DSS C-API (originally based on the DCSL/OpenDSSDirect.DLL). 24 | - [`DSS Sharp`](http://github.com/dss-extensions/dss_sharp/): .NET assembly to use the native DLL, mimics the COM object as used in .NET. 25 | - [`AltDSS-Rust`] and [`AltDSS-Go`] are new projects targeting Rust and Go programming languages. 26 | 27 | Currently, this package covers most of the COM functions and classes, besides some extensions from DSS C-API. If you find a missing function or unexpected behavior, please open an issue on GitHub to both help us track and hopefully fix it, and also inform other users. This project currently uses the [DSS C-API library version 0.13.x](https://github.com/dss-extensions/dss_capi/blob/master/docs/changelog.md). 28 | 29 | ## Highlights from 0.14.x 30 | 31 | Upgrades the engine to AltDSS/DSS C-API 0.14.x. There are some important bugfixes, a few changes ported from the official OpenDSS, and a lot of new features in our engine. 32 | 33 | This first update only updates the engine. Some new functions still need to be exposed to the MATLAB level, notably `Circuit_Save`. 34 | 35 | [See also the AltDSS/DSS C-API release notes.](https://github.com/dss-extensions/dss_capi/releases/tag/0.14.3) 36 | 37 | ## Highlights from 0.13.x 38 | 39 | Port updates from DSS-Python 0.13, integrating our base library, DSS C-API 0.13. Specific to DSS_MATLAB: 40 | 41 | - Add missing file 42 | - `DSS.AdvancedTypes` mode: when enabled, the package can return complex numbers and matrices! 43 | - `DSS.CompatFlags`: some toggles for compatibility with the official OpenDSS on some specific points. 44 | - `DSS.AllowDOScmd`: toggle running system commands from DSS scripts 45 | - Fix many docstring typos 46 | - Fix some arrays of strings: some functions were broken during the DSSContext migration. 47 | - Use enums for some properties: easier to read, more maintainable. 48 | - Introduce a few new functions added in the official COM API. 49 | - Updated our simple example script. 50 | 51 | [See also the DSS C-API 0.13.0 notes.](https://github.com/dss-extensions/dss_capi/releases/tag/0.13.0) 52 | 53 | ## Highlights from 0.12.2 54 | 55 | - Migrate to the DSSContext (`ctx_*`) API. This fixes some results when using multiple actors (PM). 56 | 57 | - Monitors: fix `ByteStream` 58 | 59 | ## Highlights from 0.12.1 60 | 61 | - `Parallel` API is now supported. Diakoptics and a few corner features are still disabled (under reimplementation). 62 | 63 | - `Storage` API added. 64 | 65 | - Support for ZIP files 66 | 67 | - Several new functions across the different classes 68 | 69 | - Initial support for exporting JSON data 70 | 71 | - Better error messages 72 | 73 | - A reference document listing the DSS commands and properties for all DSS elements is now available at https://github.com/dss-extensions/dss_capi/blob/master/docs/dss_properties.md 74 | 75 | A long list of changes is available at [DSS C-API changelog](https://github.com/dss-extensions/dss_capi/blob/master/docs/changelog.md#version-0120). 76 | 77 | ## Usage 78 | 79 | 1. Download a package from the [releases page](https://github.com/dss-extensions/dss_matlab/releases). 80 | 81 | 2. Add the folder containing `+DSS_MATLAB` to your MATLAB path. 82 | 83 | 3. Instantiate `DSS_MATLAB.IDSS`. For example: 84 | 85 | ```matlab 86 | dss = DSS_MATLAB.IDSS; 87 | ``` 88 | 89 | 4. If you find issues or missing features, feel free to [open an issue ticket on GitHub](https://github.com/dss-extensions/dss_matlab/issues/new) or email me (pmeira at ieee.org). 90 | 91 | If your code is based on `DSSStartup.m` from the examples, in general you only need to replace the `Obj = actxserver('OpenDSSEngine.DSS');` line. That is, update `DSSStartup.m` to: 92 | 93 | ```matlab 94 | %-------------------------------------------------------------------------- 95 | function [Start,Obj,Text] = DSSStartup 96 | % Function for starting up the DSS 97 | 98 | %instantiate the DSS Object 99 | Obj = DSS_MATLAB.IDSS; 100 | % 101 | %Start the DSS. Only needs to be executed the first time w/in a 102 | %Matlab session 103 | Start = Obj.Start(0); 104 | 105 | % Define the text interface 106 | Text = Obj.Text; 107 | ``` 108 | 109 | On 2019-07-02, a simple example for the IEEE13 system was added in [13Bus.zip](https://github.com/dss-extensions/dss_matlab/raw/master/examples/13Bus.zip) if you want to try DSS_MATLAB with a sample circuit. This file is now also included in the download package. 110 | 111 | If you want more code to play with, you can use the MATLAB examples from the official OpenDSS distribution, from a local installation (e.g. `C:\OpenDSS\Examples\Matlab`) or from the [official SVN repository](https://sourceforge.net/p/electricdss/code/HEAD/tree/trunk/Distrib/Examples/Matlab/). 112 | 113 | [Sandia's GridPV toolbox](https://pvpmc.sandia.gov/applications/gridpv-toolbox/) has been confirmed to work with very minor changes. Note that the toolbox seems to be out-of-date for some features, so don't expect everything to work even with COM (e.g. Google Maps integration seems broken nowadays). 114 | 115 | **As a general advice (valid for the official COM version and DSS_MATLAB), avoid using the `get` function without parameters on OpenDSS classes. Some properties like `First` and `Next` used for iteration of elements change the current active element and can lead to misleading data!** 116 | 117 | ### Some documentation? 118 | 119 | Remember that this package is meant to be a drop-in replacement for the official COM implementation, consequently the official documents/help already covers a lot. Conversely, a lot of our documentation can be used with the official OpenDSS implementation (just ignore anything marked "API Extension"). 120 | 121 | 1. The basic MATLAB `help` command can be used to get a list of functions and properties available in the objects. 122 | 2. The DSS-Python reference can be useful for discoverability, e.g. [The DSS instance](https://dss-extensions.org/dss_python/#the-dss-instance). [DSS Sharp](https://dss-extensions.org/dss_sharp/) reference is also an alternative. 123 | 3. We have an online document listing most DSS properties and commands at [DSS-Extensions: OpenDSS Commands and Properties](https://dss-extensions.org/dss_properties.html). 124 | 4. This official OpenDSS COM lists the official API contents: https://opendss.epri.com/COMInterface.html 125 | 126 | ## Known differences and history 127 | 128 | We maintain a list of important differences between the official COM implementation and DSS C-API at: 129 | 130 | https://github.com/dss-extensions/dss_capi/blob/master/docs/known_differences.md 131 | 132 | Most of these apply indirectly to DSS_MATLAB. 133 | 134 | The [list of important changes](https://github.com/dss-extensions/dss_capi/blob/master/docs/changelog.md#version-0130) through development is also useful. 135 | 136 | ## Credits / Acknowlegement 137 | 138 | This project is derived from EPRI's OpenDSS and the same style of license (BSD style) is used. As OpenDSS, the project also depends on KLUSolve and SuiteSparse, licensed under the LGPL. 139 | 140 | See the [DSS C-API](https://github.com/dss-extensions/dss_capi/) project for more details and source files. 141 | 142 | -------------------------------------------------------------------------------- /examples/13Bus.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dss-extensions/dss_matlab/0d0f19aa9a030523248275d4d644aa65db494679/examples/13Bus.zip -------------------------------------------------------------------------------- /examples/13Bus/IEEE13Node_BusXY.csv: -------------------------------------------------------------------------------- 1 | SourceBus, 200, 400 2 | 650, 200, 350 3 | RG60, 200, 300 4 | 646, 0, 250 5 | 645, 100, 250 6 | 632, 200, 250 7 | 633, 350, 250 8 | 634, 400, 250 9 | 670, 200, 200 10 | 611, 0, 100 11 | 684, 100, 100 12 | 671, 200, 100 13 | 692, 250, 100 14 | 675, 400, 100 15 | 652, 100, 0 16 | 680, 200, 0 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/13Bus/IEEE13Nodeckt.dss: -------------------------------------------------------------------------------- 1 | Clear 2 | Set DefaultBaseFrequency=60 3 | 4 | ! 5 | ! This script is based on a script developed by Tennessee Tech Univ students 6 | ! Tyler Patton, Jon Wood, and David Woods, April 2009 7 | ! 8 | 9 | new circuit.IEEE13Nodeckt 10 | ~ basekv=115 pu=1.0001 phases=3 bus1=SourceBus 11 | ~ Angle=30 ! advance angle 30 deg so result agree with published angle 12 | ~ MVAsc3=20000 MVASC1=21000 ! stiffen the source to approximate inf source 13 | 14 | 15 | 16 | !SUB TRANSFORMER DEFINITION 17 | ! Although this data was given, it does not appear to be used in the test case results 18 | ! The published test case starts at 1.0 per unit at Bus 650. To make this happen, we will change the impedance 19 | ! on the transformer to something tiny by dividing by 1000 using the DSS in-line RPN math 20 | New Transformer.Sub Phases=3 Windings=2 XHL=(8 1000 /) 21 | ~ wdg=1 bus=SourceBus conn=delta kv=115 kva=5000 %r=(.5 1000 /) 22 | ~ wdg=2 bus=650 conn=wye kv=4.16 kva=5000 %r=(.5 1000 /) 23 | 24 | ! FEEDER 1-PHASE VOLTAGE REGULATORS 25 | ! Define low-impedance 2-wdg transformer 26 | 27 | New Transformer.Reg1 phases=1 bank=reg1 XHL=0.01 kVAs=[1666 1666] 28 | ~ Buses=[650.1 RG60.1] kVs=[2.4 2.4] %LoadLoss=0.01 29 | new regcontrol.Reg1 transformer=Reg1 winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 30 | 31 | New Transformer.Reg2 phases=1 bank=reg1 XHL=0.01 kVAs=[1666 1666] 32 | ~ Buses=[650.2 RG60.2] kVs=[2.4 2.4] %LoadLoss=0.01 33 | new regcontrol.Reg2 transformer=Reg2 winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 34 | 35 | New Transformer.Reg3 phases=1 bank=reg1 XHL=0.01 kVAs=[1666 1666] 36 | ~ Buses=[650.3 RG60.3] kVs=[2.4 2.4] %LoadLoss=0.01 37 | new regcontrol.Reg3 transformer=Reg3 winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 38 | 39 | 40 | !TRANSFORMER DEFINITION 41 | New Transformer.XFM1 Phases=3 Windings=2 XHL=2 42 | ~ wdg=1 bus=633 conn=Wye kv=4.16 kva=500 %r=.55 XHT=1 43 | ~ wdg=2 bus=634 conn=Wye kv=0.480 kva=500 %r=.55 XLT=1 44 | 45 | 46 | !LINE CODES 47 | redirect IEEELineCodes.dss 48 | 49 | // these are local matrix line codes 50 | // corrected 9-14-2011 51 | New linecode.mtx601 nphases=3 BaseFreq=60 52 | ~ rmatrix = (0.3465 | 0.1560 0.3375 | 0.1580 0.1535 0.3414 ) 53 | ~ xmatrix = (1.0179 | 0.5017 1.0478 | 0.4236 0.3849 1.0348 ) 54 | ~ units=mi 55 | New linecode.mtx602 nphases=3 BaseFreq=60 56 | ~ rmatrix = (0.7526 | 0.1580 0.7475 | 0.1560 0.1535 0.7436 ) 57 | ~ xmatrix = (1.1814 | 0.4236 1.1983 | 0.5017 0.3849 1.2112 ) 58 | ~ units=mi 59 | New linecode.mtx603 nphases=2 BaseFreq=60 60 | ~ rmatrix = (1.3238 | 0.2066 1.3294 ) 61 | ~ xmatrix = (1.3569 | 0.4591 1.3471 ) 62 | ~ units=mi 63 | New linecode.mtx604 nphases=2 BaseFreq=60 64 | ~ rmatrix = (1.3238 | 0.2066 1.3294 ) 65 | ~ xmatrix = (1.3569 | 0.4591 1.3471 ) 66 | ~ units=mi 67 | New linecode.mtx605 nphases=1 BaseFreq=60 68 | ~ rmatrix = (1.3292 ) 69 | ~ xmatrix = (1.3475 ) 70 | ~ units=mi 71 | 72 | /*********** Original 606 Linecode ********************* 73 | 74 | You have to use this to match Kersting's results: 75 | 76 | New linecode.mtx606 nphases=3 BaseFreq=60 77 | ~ rmatrix = (0.7982 | 0.3192 0.7891 | 0.2849 0.3192 0.7982 ) 78 | ~ xmatrix = (0.4463 | 0.0328 0.4041 | -0.0143 0.0328 0.4463 ) 79 | ~ Cmatrix = [257 | 0 257 | 0 0 257] ! <--- This is too low by 1.5 80 | ~ units=mi 81 | 82 | Corrected mtx606 Feb 3 2016 by RDugan 83 | 84 | The new LineCode.606 is computed using the following CN cable definition and 85 | LineGeometry definition: 86 | 87 | New CNDATA.250_1/3 k=13 DiaStrand=0.064 Rstrand=2.816666667 epsR=2.3 88 | ~ InsLayer=0.220 DiaIns=1.06 DiaCable=1.16 Rac=0.076705 GMRac=0.20568 diam=0.573 89 | ~ Runits=kft Radunits=in GMRunits=in 90 | 91 | New LineGeometry.606 nconds=3 nphases=3 units=ft 92 | ~ cond=1 cncable=250_1/3 x=-0.5 h= -4 93 | ~ cond=2 cncable=250_1/3 x=0 h= -4 94 | ~ cond=3 cncable=250_1/3 x=0.5 h= -4 95 | 96 | ****End Comment******/ 97 | 98 | New Linecode.mtx606 nphases=3 Units=mi 99 | ~ Rmatrix=[0.791721 |0.318476 0.781649 |0.28345 0.318476 0.791721 ] 100 | ~ Xmatrix=[0.438352 |0.0276838 0.396697 |-0.0184204 0.0276838 0.438352 ] 101 | ~ Cmatrix=[383.948 |0 383.948 |0 0 383.948 ] 102 | New linecode.mtx607 nphases=1 BaseFreq=60 103 | ~ rmatrix = (1.3425 ) 104 | ~ xmatrix = (0.5124 ) 105 | ~ cmatrix = [236] 106 | ~ units=mi 107 | 108 | 109 | !LOAD DEFINITIONS 110 | New Load.671 Bus1=671.1.2.3 Phases=3 Conn=Delta Model=1 kV=4.16 kW=1155 kvar=660 111 | New Load.634a Bus1=634.1 Phases=1 Conn=Wye Model=1 kV=0.277 kW=160 kvar=110 112 | New Load.634b Bus1=634.2 Phases=1 Conn=Wye Model=1 kV=0.277 kW=120 kvar=90 113 | New Load.634c Bus1=634.3 Phases=1 Conn=Wye Model=1 kV=0.277 kW=120 kvar=90 114 | New Load.645 Bus1=645.2 Phases=1 Conn=Wye Model=1 kV=2.4 kW=170 kvar=125 115 | New Load.646 Bus1=646.2.3 Phases=1 Conn=Delta Model=2 kV=4.16 kW=230 kvar=132 116 | New Load.692 Bus1=692.3.1 Phases=1 Conn=Delta Model=5 kV=4.16 kW=170 kvar=151 117 | New Load.675a Bus1=675.1 Phases=1 Conn=Wye Model=1 kV=2.4 kW=485 kvar=190 118 | New Load.675b Bus1=675.2 Phases=1 Conn=Wye Model=1 kV=2.4 kW=68 kvar=60 119 | New Load.675c Bus1=675.3 Phases=1 Conn=Wye Model=1 kV=2.4 kW=290 kvar=212 120 | New Load.611 Bus1=611.3 Phases=1 Conn=Wye Model=5 kV=2.4 kW=170 kvar=80 121 | New Load.652 Bus1=652.1 Phases=1 Conn=Wye Model=2 kV=2.4 kW=128 kvar=86 122 | New Load.670a Bus1=670.1 Phases=1 Conn=Wye Model=1 kV=2.4 kW=17 kvar=10 123 | New Load.670b Bus1=670.2 Phases=1 Conn=Wye Model=1 kV=2.4 kW=66 kvar=38 124 | New Load.670c Bus1=670.3 Phases=1 Conn=Wye Model=1 kV=2.4 kW=117 kvar=68 125 | 126 | !CAPACITOR DEFINITIONS 127 | New Capacitor.Cap1 Bus1=675 phases=3 kVAR=600 kV=4.16 128 | New Capacitor.Cap2 Bus1=611.3 phases=1 kVAR=100 kV=2.4 129 | 130 | !Bus 670 is the concentrated point load of the distributed load on line 632 to 671 located at 1/3 the distance from node 632 131 | 132 | !LINE DEFINITIONS 133 | New Line.650632 Phases=3 Bus1=RG60.1.2.3 Bus2=632.1.2.3 LineCode=mtx601 Length=2000 units=ft 134 | New Line.632670 Phases=3 Bus1=632.1.2.3 Bus2=670.1.2.3 LineCode=mtx601 Length=667 units=ft 135 | New Line.670671 Phases=3 Bus1=670.1.2.3 Bus2=671.1.2.3 LineCode=mtx601 Length=1333 units=ft 136 | New Line.671680 Phases=3 Bus1=671.1.2.3 Bus2=680.1.2.3 LineCode=mtx601 Length=1000 units=ft 137 | New Line.632633 Phases=3 Bus1=632.1.2.3 Bus2=633.1.2.3 LineCode=mtx602 Length=500 units=ft 138 | New Line.632645 Phases=2 Bus1=632.3.2 Bus2=645.3.2 LineCode=mtx603 Length=500 units=ft 139 | New Line.645646 Phases=2 Bus1=645.3.2 Bus2=646.3.2 LineCode=mtx603 Length=300 units=ft 140 | New Line.692675 Phases=3 Bus1=692.1.2.3 Bus2=675.1.2.3 LineCode=mtx606 Length=500 units=ft 141 | New Line.671684 Phases=2 Bus1=671.1.3 Bus2=684.1.3 LineCode=mtx604 Length=300 units=ft 142 | New Line.684611 Phases=1 Bus1=684.3 Bus2=611.3 LineCode=mtx605 Length=300 units=ft 143 | New Line.684652 Phases=1 Bus1=684.1 Bus2=652.1 LineCode=mtx607 Length=800 units=ft 144 | 145 | 146 | !SWITCH DEFINITIONS 147 | New Line.671692 Phases=3 Bus1=671 Bus2=692 Switch=y r1=1e-4 r0=1e-4 x1=0.000 x0=0.000 c1=0.000 c0=0.000 148 | 149 | Set Voltagebases=[115, 4.16, .48] 150 | calcv 151 | Solve 152 | BusCoords IEEE13Node_BusXY.csv 153 | 154 | !--------------------------------------------------------------------------------------------------------------------------------------------------- 155 | !----------------Show some Results ----------------------------------------------------------------------------------------------------------------- 156 | !--------------------------------------------------------------------------------------------------------------------------------------------------- 157 | 158 | 159 | // Show Voltages LN Nodes 160 | // Show Currents Elem 161 | // Show Powers kVA Elem 162 | // Show Losses 163 | // Show Taps 164 | 165 | !--------------------------------------------------------------------------------------------------------------------------------------------------- 166 | !--------------------------------------------------------------------------------------------------------------------------------------------------- 167 | ! Alternate Solution Script 168 | ! To force the taps to be same as published results, set the transformer taps manually and disable the controls 169 | !--------------------------------------------------------------------------------------------------------------------------------------------------- 170 | /* 171 | Transformer.Reg1.Taps=[1.0 1.0625] 172 | Transformer.Reg2.Taps=[1.0 1.0500] 173 | Transformer.Reg3.Taps=[1.0 1.06875] 174 | Set Controlmode=OFF 175 | 176 | Solve 177 | */ -------------------------------------------------------------------------------- /examples/13Bus/run.m: -------------------------------------------------------------------------------- 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 | 24 | %% Path setup 25 | % If you have not already added DSS_MATLAB to your MATLAB path, you can 26 | % use a command like one of the following -- adjust path as necessary: 27 | 28 | %path(path, 'c:\users\username\dss_matlab'); 29 | %path(path, '/home/username/dss_matlab'); 30 | %path(path, '/Users/username/dss_matlab'); 31 | 32 | %% Loading the DSS library 33 | % Instantiate the main DSS object. This presents the same main structure 34 | % as the COM object created with "actxserver('OpenDSSEngine.DSS');" 35 | 36 | DSS = DSS_MATLAB.IDSS; 37 | 38 | % If you get a complaint about missing library, you may have downloaded 39 | % the wrong file. Be sure to download the package for your OS from 40 | % 41 | % https://github.com/dss-extensions/dss_matlab/releases/latest 42 | 43 | 44 | %% Some useful aliases 45 | % With the library loaded, most of the features from the COM version are 46 | % implemented. 47 | 48 | % For example, to reduce the code, it may be helpful to get reference to some of the 49 | % objects: 50 | Text = DSS.Text; 51 | Circuit = DSS.ActiveCircuit; 52 | Solution = DSS.ActiveCircuit.Solution; 53 | Bus = DSS.ActiveCircuit.ActiveBus; 54 | Load = DSS.ActiveCircuit.Loads; 55 | Monitors = DSS.ActiveCircuit.Monitors; 56 | CE = DSS.ActiveCircuit.ActiveCktElement; 57 | 58 | % You can get some very basic description of the properties for most of the 59 | % objects: 60 | 61 | help Text 62 | 63 | 64 | %% Running a simple system 65 | % We included the IEEE13 circuit files in this folder. Let's try to run it. 66 | 67 | Text.Command = 'redirect "IEEE13Nodeckt.dss"'; 68 | 69 | % Let's check for convergence: 70 | disp('Power flow converged?') 71 | disp(Solution.Converged) 72 | 73 | % And plot the voltages for each node 74 | figure; 75 | plot(1:Circuit.NumNodes, Circuit.AllBusVmagPu, 'o-') 76 | 77 | xlabel('Node number'); 78 | ylabel('Voltage (pu)'); 79 | 80 | 81 | %% Inspecting a single bus 82 | 83 | % The names... 84 | Circuit.AllBusNames 85 | 86 | Circuit.SetActiveBus('680'); 87 | 88 | Bus.Voltages 89 | 90 | %% Inspecting the loads 91 | 92 | idx = Load.First; 93 | while idx ~= 0 94 | fprintf('Load %s - rated power: %g kW, %g kvar\n', Load.Name, Load.kW, Load.kvar); 95 | idx = Load.Next; 96 | end 97 | 98 | %% Plotting some data 99 | 100 | % Let's get the bus coordinates and some date to plot. 101 | % Please note that not every system or bus has coordinates defined. 102 | 103 | x = zeros(Circuit.NumBuses, 1); 104 | y = zeros(Circuit.NumBuses, 1); 105 | data = zeros(Circuit.NumBuses, 1); 106 | for bus_number=1:Circuit.NumBuses 107 | Circuit.SetActiveBusi(bus_number); 108 | x(bus_number) = Bus.x; 109 | y(bus_number) = Bus.y; 110 | data(bus_number) = mean(Bus.puVmagAngle(1:2:end)); 111 | end 112 | 113 | figure; 114 | scatter(x, y, 50, data, 's', 'filled'); 115 | handle = colorbar(); 116 | xlabel('Bus X coordinate'); 117 | ylabel('Bus Y coordinate'); 118 | ylabel(handle, 'Voltage (pu)'); 119 | 120 | %% Monitors, including the AsMatrix function (API extension) 121 | 122 | % Let's edit the circuit to add some variation, add a monitor, and solve 123 | Text.Command = 'BatchEdit Load..* Daily=default'; 124 | Text.Command = 'New Monitor.test Element=Transformer.Sub Mode=1'; 125 | Solution.Mode = int32(DSS_MATLAB.SolveModes.Daily); 126 | Solution.Solve(); 127 | 128 | % Now plot the first channel of the monitor 129 | figure; 130 | Monitors.Name = 'test'; 131 | plot(Monitors.dblHour, Monitors.Channel(1)); 132 | Monitors.dblHour 133 | xlabel('Time (h)'); 134 | header = Monitors.Header(); 135 | ylabel(header(1)); 136 | 137 | % We can also get all data as a matrix; the first two columns are the 138 | % integer hours and seconds (for a time solution) 139 | figure; 140 | mon_mat = Monitors.AsMatrix(); 141 | h = mon_mat(1, :) + mon_mat(2, :) / 3600; 142 | plot(h, mon_mat(3:end, :)); 143 | xlabel('Time (h)'); 144 | legend(header); 145 | 146 | %% Raw DSS properties 147 | 148 | % Although the Text interface can be convenient to read properties not 149 | % exposed by the API, OpenDSS also provides a dedicated Properties API 150 | % that can be useful for elements that don't have dedicated APIs. 151 | Circuit.SetActiveElement('Transformer.Sub') 152 | Prop = CE.Properties('Windings'); 153 | fprintf('Property Name: %s, Value: %s', Prop.Name, Prop.Val); 154 | 155 | %% Loading circuits from ZIP files (API extension, not available in the official OpenDSS) 156 | 157 | DSS.ClearAll(); 158 | ZIP = DSS.ZIP; 159 | ZIP.Open('../13Bus.zip'); 160 | 161 | ZIP.List() 162 | 163 | % Running the DSS script directly from the ZIP. 164 | % This also restricts loading most files only from the ZIP archive, 165 | % so you have to use relative paths. 166 | ZIP.Redirect('13Bus/IEEE13Nodeckt.dss'); 167 | 168 | ZIP.Close(); 169 | 170 | DSS.ActiveCircuit.NumBuses 171 | 172 | %% Activating "AdvancedTypes" (API extension, not available in the official OpenDSS) 173 | 174 | DSS.AdvancedTypes = true; 175 | 176 | % This is now a complex array, instead of the classic pair-of-reals array 177 | Circuit.AllBusVolts 178 | 179 | % Other data will also be complex, and in matrix form: 180 | Circuit.Lines.First; 181 | Circuit.Lines.Name 182 | Circuit.Lines.Yprim 183 | --------------------------------------------------------------------------------