@@ -81,7 +81,7 @@ namespace GridKit
8181 TestOutcome jacobian ()
8282 {
8383 TestStatus success = true ;
84-
84+
8585 real_type R{2.0 }; // /< Branch series resistance
8686 real_type X{4.0 }; // /< Branch series reactance
8787 real_type G{0.2 }; // /< Branch shunt conductance
@@ -91,7 +91,7 @@ namespace GridKit
9191 Sparse::Variable Vi1{20.0 }; // /< Bus-1 imaginary voltage
9292 Sparse::Variable Vr2{30.0 }; // /< Bus-2 real voltage
9393 Sparse::Variable Vi2{40.0 }; // /< Bus-2 imaginary voltage
94-
94+
9595 Vr1.setVariableNumber (0 ); // /< Independent variables: first
9696 Vi1.setVariableNumber (1 ); // /< Independent variables: second
9797 Vr2.setVariableNumber (2 ); // /< Independent variables: third
@@ -101,17 +101,17 @@ namespace GridKit
101101 PhasorDynamics::BusInfinite<Sparse::Variable, IdxT> bus2 (Vr2, Vi2);
102102
103103 PhasorDynamics::Branch<Sparse::Variable, IdxT> branch (&bus1, &bus2, R, X, G, B);
104- branch.evaluateResidual (); // /< Computes the residual and the Jacobian values by tracking
104+ branch.evaluateResidual (); // /< Computes the residual and the Jacobian values by tracking
105105 // /< the dependencies
106106
107- std::vector<Sparse::Variable> residuals{bus1.Ir (), bus1.Ii (), bus2.Ir (), bus2.Ii ()};
107+ std::vector<Sparse::Variable> residuals{bus1.Ir (), bus1.Ii (), bus2.Ir (), bus2.Ii ()};
108108 std::vector<Sparse::Variable::DependencyMap> ref = analyticalJacobian (R, X, G, B);
109109 for (size_t i = 0 ; i < residuals.size (); ++i)
110110 {
111- Sparse::Variable res = residuals[i];
112- const Sparse::Variable::DependencyMap& dependencies = res.getDependencies ();
113- success *= (dependencies == ref[i]); // /< Compare dependencies computed automatically
114- // /< to the ones computed analytically
111+ Sparse::Variable res = residuals[i];
112+ const Sparse::Variable::DependencyMap& dependencies = res.getDependencies ();
113+ success *= (dependencies == ref[i]); // /< Compare dependencies computed automatically
114+ // /< to the ones computed analytically
115115 }
116116
117117 return success.report (__func__);
@@ -179,6 +179,7 @@ namespace GridKit
179179
180180 return success.report (__func__);
181181 }
182+
182183 private:
183184 std::vector<Sparse::Variable::DependencyMap> analyticalJacobian (const real_type R,
184185 const real_type X,
@@ -187,23 +188,23 @@ namespace GridKit
187188 {
188189 const real_type b = -X / (R * R + X * X);
189190 const real_type g = R / (R * R + X * X);
190-
191+
191192 real_type dIr1_dVr1 = -(g + 0.5 * G);
192193 real_type dIr1_dVi1 = (b + 0.5 * B);
193194 real_type dIr1_dVr2 = g;
194195 real_type dIr1_dVi2 = -b;
195196
196- real_type dIi1_dVr1 = -(b + 0.5 * B);
197+ real_type dIi1_dVr1 = -(b + 0.5 * B);
197198 real_type dIi1_dVi1 = -(g + 0.5 * G);
198199 real_type dIi1_dVr2 = b;
199200 real_type dIi1_dVi2 = g;
200-
201- real_type dIr2_dVr1 = g;
201+
202+ real_type dIr2_dVr1 = g;
202203 real_type dIr2_dVi1 = -b;
203204 real_type dIr2_dVr2 = -(g + 0.5 * G);
204205 real_type dIr2_dVi2 = (b + 0.5 * B);
205-
206- real_type dIi2_dVr1 = b;
206+
207+ real_type dIi2_dVr1 = b;
207208 real_type dIi2_dVi1 = g;
208209 real_type dIi2_dVr2 = -(b + 0.5 * B);
209210 real_type dIi2_dVi2 = -(g + 0.5 * G);
0 commit comments