|
52 | 52 | Solution = DSS.ActiveCircuit.Solution;
|
53 | 53 | Bus = DSS.ActiveCircuit.ActiveBus;
|
54 | 54 | Load = DSS.ActiveCircuit.Loads;
|
| 55 | +Monitors = DSS.ActiveCircuit.Monitors; |
| 56 | +CE = DSS.ActiveCircuit.ActiveCktElement; |
55 | 57 |
|
56 | 58 | % You can get some very basic description of the properties for most of the
|
57 | 59 | % objects:
|
|
115 | 117 | ylabel('Bus Y coordinate');
|
116 | 118 | ylabel(handle, 'Voltage (pu)');
|
117 | 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 | + |
118 | 155 | %% Loading circuits from ZIP files (API extension, not available in the official OpenDSS)
|
119 | 156 |
|
120 | 157 | DSS.ClearAll();
|
121 | 158 | ZIP = DSS.ZIP;
|
122 |
| -ZIP.Open('../13Bus.zip') |
| 159 | +ZIP.Open('../13Bus.zip'); |
123 | 160 |
|
124 | 161 | ZIP.List()
|
125 | 162 |
|
126 | 163 | % Running the DSS script directly from the ZIP.
|
127 | 164 | % This also restricts loading most files only from the ZIP archive,
|
128 | 165 | % so you have to use relative paths.
|
129 |
| -ZIP.Redirect('13Bus/IEEE13Nodeckt.dss') |
| 166 | +ZIP.Redirect('13Bus/IEEE13Nodeckt.dss'); |
130 | 167 |
|
131 |
| -ZIP.Close() |
| 168 | +ZIP.Close(); |
132 | 169 |
|
133 | 170 | DSS.ActiveCircuit.NumBuses
|
134 | 171 |
|
|
0 commit comments