@@ -107,27 +107,27 @@ is the ability to get numeric data directly for different scenarios according to
107107For example, suppose you wanted to compare the voltages for two scenarios of load.
108108
109109``` csharp
110- engine .ActiveCircuit .Solution .LoadMult = 1 . 0 ;
111- engine .ActiveCircuit .Solution .Solve ();
112- var voltages_base = engine .ActiveCircuit .AllBusVmagPu ;
110+ engine .ActiveCircuit .Solution .LoadMult = 1 . 0 ;
111+ engine .ActiveCircuit .Solution .Solve ();
112+ var voltages_base = engine .ActiveCircuit .AllBusVmagPu ;
113113
114- engine .ActiveCircuit .Solution .LoadMult = 1 . 5 ;
115- engine .ActiveCircuit .Solution .Solve ();
116- var voltage_150 = engine .ActiveCircuit .AllBusVmagPu ;
114+ engine .ActiveCircuit .Solution .LoadMult = 1 . 5 ;
115+ engine .ActiveCircuit .Solution .Solve ();
116+ var voltage_150 = engine .ActiveCircuit .AllBusVmagPu ;
117117```
118118
119119You can of course get references to the API elements to make the code less verbose, for example:
120120
121121``` csharp
122- var circ = engine .ActiveCircuit ;
123-
124- circ .Solution .LoadMult = 1 . 0 ;
125- circ .Solution .Solve ();
126- var voltages_base = circ .AllBusVmagPu ;
127-
128- circ .Solution .LoadMult = 1 . 5 ;
129- engine .ActiveCircuit .Solution .Solve ();
130- var voltage_150 = circ .AllBusVmagPu ;
122+ var circ = engine .ActiveCircuit ;
123+
124+ circ .Solution .LoadMult = 1 . 0 ;
125+ circ .Solution .Solve ();
126+ var voltages_base = circ .AllBusVmagPu ;
127+
128+ circ .Solution .LoadMult = 1 . 5 ;
129+ engine .ActiveCircuit .Solution .Solve ();
130+ var voltage_150 = circ .AllBusVmagPu ;
131131```
132132
133133You are free to use various methods and other .NET packages to compare and evaluate the voltage arrays.
@@ -151,20 +151,20 @@ To better illustrate, let's add a simple chart of the voltages for difference lo
151151``` csharp
152152 private void button3_Click (object sender , EventArgs e )
153153 {
154- // Try running the test circuit
155- try
156- {
157- engine .Text .Command = @" compile 'C:\Program Files\OpenDSS\IEEETestCases\13Bus\IEEE13Nodeckt.dss'" ;
158- }
159- catch (DSSException ex )
160- {
161- MessageBox .Show (ex .Message );
162- return ;
163- }
164-
165- var circ = engine .ActiveCircuit ;
166-
167- // Create an array for the x-axis and clear any previous plot
154+ // Try running the test circuit
155+ try
156+ {
157+ engine .Text .Command = @" compile 'C:\Program Files\OpenDSS\IEEETestCases\13Bus\IEEE13Nodeckt.dss'" ;
158+ }
159+ catch (DSSException ex )
160+ {
161+ MessageBox .Show (ex .Message );
162+ return ;
163+ }
164+
165+ var circ = engine .ActiveCircuit ;
166+
167+ // Create an array for the x-axis and clear any previous plot
168168 var x = new double [circ .NumNodes ];
169169 for (int i = 0 ; i < x .Length ; ++ i )
170170 {
@@ -173,34 +173,34 @@ To better illustrate, let's add a simple chart of the voltages for difference lo
173173 var plot = formsPlot1 .Plot ;
174174 plot .Clear ();
175175
176- // Ensure the solution mode is snapshot, and solve the base case
177- circ .Solution .Mode = (int )SolveModes .dssSnapShot ;
176+ // Ensure the solution mode is snapshot, and solve the base case
177+ circ .Solution .Mode = (int )SolveModes .dssSnapShot ;
178178 circ .Solution .LoadMult = 1 . 0 ;
179179 circ .Solution .Solve ();
180180
181- // Be sure to check the convergency since it doesn't necessarily becomes
182- // an error/exception if the system fails to converge.
183- if (! circ .Solution .Converged )
184- {
185- MessageBox .Show (" Failed to converge." );
186- return ;
187- }
188-
189- // Add the base plot
181+ // Be sure to check the convergency since it doesn't necessarily becomes
182+ // an error/exception if the system fails to converge.
183+ if (! circ .Solution .Converged )
184+ {
185+ MessageBox .Show (" Failed to converge." );
186+ return ;
187+ }
188+
189+ // Add the base plot
190190 plot .AddScatter (x , circ .AllBusVmagPu , label : " Base case" );
191191
192- // Solve the 1.5x load case, add it to the plot
192+ // Solve the 1.5x load case, add it to the plot
193193 circ .Solution .LoadMult = 1 . 5 ;
194194 circ .Solution .Solve ();
195- if (! circ .Solution .Converged )
196- {
197- MessageBox .Show (" Failed to converge." );
198- return ;
199- }
200-
195+ if (! circ .Solution .Converged )
196+ {
197+ MessageBox .Show (" Failed to converge." );
198+ return ;
199+ }
200+
201201 plot .AddScatter (x , circ .AllBusVmagPu , label : " 1.5x load" );
202202
203- // Finishing touches to the chart
203+ // Finishing touches to the chart
204204 plot .Legend ();
205205 plot .XLabel (" Bus index" );
206206 plot .YLabel (" Voltage (pu)" );
@@ -256,10 +256,10 @@ The initialization could also be adjusted to disable certain dss_sharp features
256256 dss_sharp .Error .UseExceptions = false ;
257257
258258 // Disable the early-abort mechanism.
259- // Without it, the engine may continue to run ignoring
260- // some errors -- we highly advice against it, but you
261- // may need to do this to check your COM-based code before
262- // migrating to dss_sharp.
259+ // Without it, the engine may continue to run ignoring
260+ // some errors -- we highly advice against it, but you
261+ // may need to do this to check your COM-based code before
262+ // migrating to dss_sharp.
263263 engine .Error .EarlyAbort = false ;
264264
265265 // There are other flags that could be useful;
0 commit comments