@@ -26,6 +26,39 @@ using scalar_type = double;
2626using real_type = double ;
2727using index_type = size_t ;
2828
29+ // / Machine data shared by the example generators
30+ GridKit::PhasorDynamics::GenrouData<real_type, index_type> genData (real_type p0, real_type q0)
31+ {
32+ using Parameter = GridKit::PhasorDynamics::GenrouParameters;
33+
34+ GridKit::PhasorDynamics::GenrouData<real_type, index_type> data;
35+ data.parameters [Parameter::p0] = p0;
36+ data.parameters [Parameter::q0] = q0;
37+
38+ return data;
39+ }
40+
41+ // / Branch data with the given line and transformer parameters
42+ GridKit::PhasorDynamics::BranchData<real_type, index_type> branchData (const real_type R,
43+ const real_type X,
44+ const real_type G,
45+ const real_type B,
46+ const real_type tap = 1.0 ,
47+ const real_type phase = 0.0 )
48+ {
49+ using Parameter = GridKit::PhasorDynamics::BranchParameters;
50+
51+ GridKit::PhasorDynamics::BranchData<real_type, index_type> data;
52+ data.parameters [Parameter::R] = R;
53+ data.parameters [Parameter::X] = X;
54+ data.parameters [Parameter::G] = G;
55+ data.parameters [Parameter::B] = B;
56+ data.parameters [Parameter::tap] = tap;
57+ data.parameters [Parameter::phase] = phase;
58+
59+ return data;
60+ }
61+
2962int main ()
3063{
3164 using namespace GridKit ::PhasorDynamics;
@@ -51,25 +84,25 @@ int main()
5184 Bus<scalar_type, index_type> bus9 (0.938638861502395 , 0.344901620288291 );
5285 Bus<scalar_type, index_type> bus10 (0.937739191669114 , 0.347340277548916 );
5386
54- Branch<scalar_type, index_type> branch12 (&bus1, &bus2, 0.001 , 0.005 , 0 , 0 );
55- Branch<scalar_type, index_type> branch23 (&bus2, &bus3, 0.001 , 0.005 , 0 , 0 );
56- Branch<scalar_type, index_type> branch34 (&bus3, &bus4, 0.001 , 0.005 , 0 , 0 );
57- Branch<scalar_type, index_type> branch45 (&bus4, &bus5, 0.001 , 0.005 , 0 , 0 );
58- Branch<scalar_type, index_type> branch56 (&bus5, &bus6, 0.001 , 0.1 , 0 , 0 );
59- Branch<scalar_type, index_type> branch67 (&bus6, &bus7, 0.001 , 0.005 , 0 , 0 );
60- Branch<scalar_type, index_type> branch78 (&bus7, &bus8, 0.001 , 0.005 , 0 , 0 );
61- Branch<scalar_type, index_type> branch89 (&bus8, &bus9, 0.001 , 0.005 , 0 , 0 );
62- Branch<scalar_type, index_type> branch910 (&bus9, &bus10, 0.001 , 0.005 , 0 , 0 );
63-
64- Genrou<scalar_type, index_type> gen2 (&bus2, 0.5 , -0.00442101 , 3 ., 0 ., 0 ., 7 ., . 04 , . 05 , . 75 , 2.1 , 0.2 , 0.18 , 0.5 , 0.5 , 0.18 , 0.15 , 0 ., 0 . );
65- Genrou<scalar_type, index_type> gen3 (&bus3, 0.5 , -0.02510812 , 3 ., 0 ., 0 ., 7 ., . 04 , . 05 , . 75 , 2.1 , 0.2 , 0.18 , 0.5 , 0.5 , 0.18 , 0.15 , 0 ., 0 . );
66- Genrou<scalar_type, index_type> gen4 (&bus4, 0.5 , -0.04339553 , 3 ., 0 ., 0 ., 7 ., . 04 , . 05 , . 75 , 2.1 , 0.2 , 0.18 , 0.5 , 0.5 , 0.18 , 0.15 , 0 ., 0 . );
67- Genrou<scalar_type, index_type> gen5 (&bus5, 0.5 , -0.2334993 , 3 ., 0 ., 0 ., 7 ., . 04 , . 05 , . 75 , 2.1 , 0.2 , 0.18 , 0.5 , 0.5 , 0.18 , 0.15 , 0 ., 0 . );
68- Genrou<scalar_type, index_type> gen6 (&bus6, 0.5 , 0.69907194 , 3 ., 0 ., 0 ., 7 ., . 04 , . 05 , . 75 , 2.1 , 0.2 , 0.18 , 0.5 , 0.5 , 0.18 , 0.15 , 0 ., 0 . );
69- Genrou<scalar_type, index_type> gen7 (&bus7, 0.5 , -0.08318208 , 3 ., 0 ., 0 ., 7 ., . 04 , . 05 , . 75 , 2.1 , 0.2 , 0.18 , 0.5 , 0.5 , 0.18 , 0.15 , 0 ., 0 . );
70- Genrou<scalar_type, index_type> gen8 (&bus8, 0.5 , -0.09123614 , 3 ., 0 ., 0 ., 7 ., . 04 , . 05 , . 75 , 2.1 , 0.2 , 0.18 , 0.5 , 0.5 , 0.18 , 0.15 , 0 ., 0 . );
71- Genrou<scalar_type, index_type> gen9 (&bus9, 0.5 , -0.09662372 , 3 ., 0 ., 0 ., 7 ., . 04 , . 05 , . 75 , 2.1 , 0.2 , 0.18 , 0.5 , 0.5 , 0.18 , 0.15 , 0 ., 0 . );
72- Genrou<scalar_type, index_type> gen10 (&bus10, 0.5 , -0.09932297 , 3 ., 0 ., 0 ., 7 ., . 04 , . 05 , . 75 , 2.1 , 0.2 , 0.18 , 0.5 , 0.5 , 0.18 , 0.15 , 0 ., 0 . );
87+ Branch<scalar_type, index_type> branch12 (&bus1, &bus2, branchData ( 0.001 , 0.005 , 0 , 0 ) );
88+ Branch<scalar_type, index_type> branch23 (&bus2, &bus3, branchData ( 0.001 , 0.005 , 0 , 0 ) );
89+ Branch<scalar_type, index_type> branch34 (&bus3, &bus4, branchData ( 0.001 , 0.005 , 0 , 0 ) );
90+ Branch<scalar_type, index_type> branch45 (&bus4, &bus5, branchData ( 0.001 , 0.005 , 0 , 0 ) );
91+ Branch<scalar_type, index_type> branch56 (&bus5, &bus6, branchData ( 0.001 , 0.1 , 0 , 0 ) );
92+ Branch<scalar_type, index_type> branch67 (&bus6, &bus7, branchData ( 0.001 , 0.005 , 0 , 0 ) );
93+ Branch<scalar_type, index_type> branch78 (&bus7, &bus8, branchData ( 0.001 , 0.005 , 0 , 0 ) );
94+ Branch<scalar_type, index_type> branch89 (&bus8, &bus9, branchData ( 0.001 , 0.005 , 0 , 0 ) );
95+ Branch<scalar_type, index_type> branch910 (&bus9, &bus10, branchData ( 0.001 , 0.005 , 0 , 0 ) );
96+
97+ Genrou<scalar_type, index_type> gen2 (&bus2, genData ( 0.5 , -0.00442101 ) );
98+ Genrou<scalar_type, index_type> gen3 (&bus3, genData ( 0.5 , -0.02510812 ) );
99+ Genrou<scalar_type, index_type> gen4 (&bus4, genData ( 0.5 , -0.04339553 ) );
100+ Genrou<scalar_type, index_type> gen5 (&bus5, genData ( 0.5 , -0.2334993 ) );
101+ Genrou<scalar_type, index_type> gen6 (&bus6, genData ( 0.5 , 0.69907194 ) );
102+ Genrou<scalar_type, index_type> gen7 (&bus7, genData ( 0.5 , -0.08318208 ) );
103+ Genrou<scalar_type, index_type> gen8 (&bus8, genData ( 0.5 , -0.09123614 ) );
104+ Genrou<scalar_type, index_type> gen9 (&bus9, genData ( 0.5 , -0.09662372 ) );
105+ Genrou<scalar_type, index_type> gen10 (&bus10, genData ( 0.5 , -0.09932297 ) );
73106
74107 /* Connect everything together */
75108 SystemModel<scalar_type, index_type> sys;
0 commit comments