-
Notifications
You must be signed in to change notification settings - Fork 0
/
dsim_app.cpp
65 lines (46 loc) · 1.06 KB
/
dsim_app.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <stdio.h>
#include <dsim.hpp>
#include <gridpack/include/gridpack.hpp>
int gridpack_initialize(int* argcp, char ***argvp)
{
int ierr;
// Initialize MPI library
ierr = MPI_Init(argcp,argvp);
// Initialize GA
GA_Initialize();
int stack = 200000, heap = 200000;
MA_init(C_DBL, stack, heap);
// Initialize math libraries
gridpack::math::Initialize(argcp,argvp);
return ierr;
}
int gridpack_finalize()
{
int ierr;
// Finalize Math libraries
gridpack::math::Finalize();
// Terminate GA
GA_Terminate();
// Clean up MPI libraries
ierr = MPI_Finalize();
return ierr;
}
int main(int argc, char **argv)
{
int ierr;
ierr = gridpack_initialize(&argc,&argv);
DSim *dsim = new DSim();
// Set the configuration file
dsim->setconfigurationfile("input.xml");
// Read the data. File names given in config file.
dsim->readnetworkdatafromconfig();
// Set up dynamic simulation
dsim->setup();
// Initialize
dsim->initialize();
// Solve
dsim->solve();
delete(dsim);
ierr = gridpack_finalize();
return 0;
}