### Install Example Files Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/examples/hello_world/CMakeLists.txt Configures and installs the necessary files for the hello_world example, including source files, headers, input data, and the generated CMakeLists.txt, into the share/gridpack/example/hello directory. ```cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.install.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/hw_app.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_app.hpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_components.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_components.hpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_factory.hpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/10x10.raw DESTINATION share/gridpack/example/hello ) ``` -------------------------------- ### Install Example Files Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/dynamic_simulation_dae/CMakeLists.txt Installs the CMakeLists.txt configuration, generated input.xml, raw data, dyr files, petscrc, and the application source file to a share directory for examples. ```cmake install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt ${CMAKE_CURRENT_BINARY_DIR}/input.xml ${GRIDPACK_DATA_DIR}/raw/case9.raw ${GRIDPACK_DATA_DIR}/dyr/case9_GENROU_ESST1A_WSIEG1.dyr ${GRIDPACK_DATA_DIR}/petscoptions/.petscrc ${CMAKE_CURRENT_SOURCE_DIR}/dsim_app.cpp DESTINATION share/gridpack/example/dynamic_simulation_dae ) ``` -------------------------------- ### Install State Estimation Example Files Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/state_estimation/CMakeLists.txt Installs the CMakeLists.txt configuration, generated input files, raw data, measurement files, and the main source file to a share directory for examples. ```cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.install.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt ${CMAKE_CURRENT_BINARY_DIR}/input_14.xml ${GRIDPACK_DATA_DIR}/raw/IEEE14.raw ${GRIDPACK_DATA_DIR}/measurements/IEEE14_meas.xml ${CMAKE_CURRENT_BINARY_DIR}/input_118.xml ${GRIDPACK_DATA_DIR}/raw/IEEE118.raw ${GRIDPACK_DATA_DIR}/measurements/IEEE118_meas.xml ${CMAKE_CURRENT_SOURCE_DIR}/se_main.cpp DESTINATION share/gridpack/example/state_estimation ) ``` -------------------------------- ### Install Example Configuration Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/kalman_ds/CMakeLists.txt Configures the installation of example files for the kalman_ds application. This includes source files, generated CMakeLists.txt, input XML files, raw data, dyr files, and Kalman input CSV files. ```cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.install.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/kds_main.cpp ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt ${CMAKE_CURRENT_BINARY_DIR}/input_145.xml ${GRIDPACK_DATA_DIR}/raw/IEEE145.raw ${GRIDPACK_DATA_DIR}/dyr/IEEE145_classicGen.dyr ${GRIDPACK_DATA_DIR}/kalman/IEEE145_Kalman_input_ang.csv ${GRIDPACK_DATA_DIR}/kalman/IEEE145_Kalman_input_mag.csv ${CMAKE_CURRENT_BINARY_DIR}/input_14.xml ${GRIDPACK_DATA_DIR}/raw/IEEE14_kds.raw ${GRIDPACK_DATA_DIR}/dyr/IEEE14_classicGen.dyr ${GRIDPACK_DATA_DIR}/kalman/IEEE14_Kalman_input_ang.csv ${GRIDPACK_DATA_DIR}/kalman/IEEE14_Kalman_input_mag.csv DESTINATION share/gridpack/example/kalman_ds ) install(TARGETS kds.x DESTINATION bin) ``` -------------------------------- ### Build and Run Example Application Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/UBUNTU_PPA.md Verify your GridPACK installation by building and running a power flow example application. ```bash mkdir tmpbuild cd tmpbuild cmake /usr/share/gridpack/example/powerflow make mpiexec -np 2 ./powerflow.x 118.xml ``` -------------------------------- ### Install Example Contingency Analysis Files Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/contingency_analysis/CMakeLists.txt Installs various input files, raw data, contingency definitions, and source files for the contingency analysis example. These files are placed in the share/gridpack/example/contingency_analysis directory. ```cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.install.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt ${CMAKE_CURRENT_BINARY_DIR}/input_14.xml ${CMAKE_CURRENT_BINARY_DIR}/input_14_auto_n1.xml ${CMAKE_CURRENT_BINARY_DIR}/input_14_qlim.xml ${GRIDPACK_DATA_DIR}/raw/IEEE14_ca.raw ${GRIDPACK_DATA_DIR}/contingencies/contingencies_14.xml ${GRIDPACK_DATA_DIR}/contingencies/contingencies_nk_example.xml ${CMAKE_CURRENT_BINARY_DIR}/input_118.xml ${GRIDPACK_DATA_DIR}/raw/IEEE118.raw ${GRIDPACK_DATA_DIR}/contingencies/contingencies_118.xml ${CMAKE_CURRENT_SOURCE_DIR}/ca_driver.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ca_driver.hpp ${CMAKE_CURRENT_SOURCE_DIR}/ca_main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/README.md DESTINATION share/gridpack/example/contingency_analysis ) ``` -------------------------------- ### Install Powerflow Example Application Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/examples/powerflow/CMakeLists.txt Installs the powerflow application files, including sources, generated files, and input data, to a share directory. ```cmake # ------------------------------------------------------------- # install as a sample application # ------------------------------------------------------------- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.install.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/pf_app.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pf_factory.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pf_main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pf_app.hpp ${CMAKE_CURRENT_SOURCE_DIR}/pf_factory.hpp ${CMAKE_CURRENT_BINARY_DIR}/input.xml ${CMAKE_CURRENT_SOURCE_DIR}/IEEE14.raw ${CMAKE_CURRENT_SOURCE_DIR}/gridpack.petscrc ${CMAKE_CURRENT_BINARY_DIR}/118.xml ${CMAKE_CURRENT_SOURCE_DIR}/118.raw DESTINATION share/gridpack/example/powerflow ) ``` -------------------------------- ### Example GridPACK Project Setup and Run Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/sphinx/Section2-Docker.md Demonstrates a typical workflow: creating a project directory, defining an input file, and running GridPACK within a Docker container. The container is interactive and automatically removed. ```bash # 1. Create a project directory mkdir my-gridpack-project cd my-gridpack-project # 2. Create your input files cat > input.xml << EOF EOF # 3. Run GridPACK in the container docker run -it --rm -v $(pwd):/app/workspace pnnl/gridpack:latest bash # Inside container: # powerflow.x input.xml # exit ``` -------------------------------- ### Minimal Power Flow Example in Python Source: https://github.com/gridoptics/gridpack/blob/develop/docs/python/powerflow.md This snippet demonstrates the basic setup and execution of a power flow simulation using the gridpack library in Python. It requires an input.xml configuration file. ```python import sys, os import gridpack import gridpack.powerflow env = gridpack.Environment() comm = gridpack.Communicator() config = gridpack.Configuration() config.open("input.xml", comm) pfapp = gridpack.powerflow.Powerflow() pfapp.readNetwork(config, -1) pfapp.initialize() pfapp.solve(); pfapp.write(); # try to force deletion order to avoid problems del pfapp del env ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/gridoptics/gridpack/blob/develop/python/CMakeLists.txt Initializes the CMake build system, sets the project name, and enables the C++ language. This is a standard starting point for most C++ CMake projects. ```cmake cmake_minimum_required(VERSION 3.5.0) project(gridpack-hadrec) enable_language(CXX) ``` -------------------------------- ### Compile, Install, and Check PETSc Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/BASIC_INSTALL.md Compile PETSc, install it, and run the check command to verify the installation. ```bash make make install make check ``` -------------------------------- ### Build and Install PETSc Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/MacOSX.md Compiles and installs PETSc using the specified directory and architecture. Use 'make all' for compilation and 'make install' for installation. ```bash make PETSC_DIR=/Users/d3g096/Projects/GridPACK/src/petsc-3.20.6 \ PETSC_ARCH=mpich-clang-real-shared all make PETSC_DIR=/Users/d3g096/Projects/GridPACK/src/petsc-3.20.6 \ PETSC_ARCH=mpich-clang-real-shared install ``` -------------------------------- ### Configure GridPACK with Example Script Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/RC_CLUSTER.md Use the provided example configuration script to set up GridPACK. This is often the most up-to-date method. ```bash sh ../example_configuration.sh constance ``` -------------------------------- ### Install GridPACK Library Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/modules/emt/README.md Run this script to build and install the GridPACK library after dependencies are installed. Build and install files are located in specified directories. ```bash source install_gridpack.sh ``` -------------------------------- ### Install Header File Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/components/pf_matrix/CMakeLists.txt Installs the 'pf_components.hpp' header file to the specified destination within the installation directory. ```cmake install(FILES pf_components.hpp DESTINATION include/gridpack/applications/components/pf_matrix ) ``` -------------------------------- ### Install OpenMPI Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/CENTOS7.md Install the OpenMPI library and development headers, version 1.10. This also installs the 'module' command, which is necessary for loading OpenMPI. ```bash sudo yum install openmpi openmpi-devel ``` -------------------------------- ### Install Boost libraries Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/DEBIAN.md Install the necessary Boost C++ libraries, including development headers and MPI support. This step also installs the default MPI implementation (OpenMPI). ```shell sudo apt-get install libboost-dev libboost-mpi-dev \ libboost-random-dev libboost-filesystem-dev libboost-system-dev ``` -------------------------------- ### Install Header File Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/components/kds_matrix/CMakeLists.txt Installs the 'kds_components.hpp' header file to the specified destination within the installation directory. ```cmake install(FILES kds_components.hpp DESTINATION include/gridpack/applications/components/kds_matrix ) ``` -------------------------------- ### Example XML Configuration File Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/tex/configuration.tex An example of an XML configuration file structure for a power flow and dynamic simulation application. ```XML IEEE118.raw 0.0 0.1 0.001 0.03 0.06 3 7 0.07 0.06=8 4 8 ``` -------------------------------- ### Install GridPACK Documentation and License Source: https://github.com/gridoptics/gridpack/blob/develop/src/CMakeLists.txt Installs the README.md file and the LICENSE file to the share/gridpack directory within the installation prefix. This makes essential project information available to users. ```cmake install( FILES ${GRIDPACK_SRC_DIR}/../README.md LICENSE DESTINATION share/gridpack ) ``` -------------------------------- ### Install PETSc Libraries Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/CENTOS7.md Installs the compiled PETSc libraries to the configured prefix. This step follows the build process. ```shell make PETSC_DIR=$HOME/gridpack/src/petsc-3.16.3 PETSC_ARCH=arch-linux2-complex-opt install ``` -------------------------------- ### Install Timer Header Files Source: https://github.com/gridoptics/gridpack/blob/develop/src/timer/CMakeLists.txt Installs the header files for the timer library to the appropriate include directory within the installation path. ```cmake install(FILES coarse_timer.hpp local_timer.hpp DESTINATION include/gridpack/timer ) ``` -------------------------------- ### Install Executable Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/dynamic_simulation_dae/CMakeLists.txt Installs the compiled 'dsim.x' executable to the 'bin' directory. ```cmake install(TARGETS dsim.x DESTINATION bin) ``` -------------------------------- ### Configure, Build, and Install Global Arrays (GA) Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/UBUNTU.md Builds and installs the Global Arrays library. Ensure the --prefix path is set to your desired local installation directory. ```bash ./configure --enable-i4 --without-blas --enable-cxx --with-mpi-ts --disable-f77 \ --prefix="/home/gridpack/software/ga-5.8" make make install ``` -------------------------------- ### Install Application Files Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/emt/CMakeLists.txt Installs the compiled executable and all necessary input files to their designated locations within the GridPACK installation directory. ```cmake install(FILES ${CMAKE_CURRENT_BINARY_DIR}/input_9bus2.xml ${CMAKE_CURRENT_BINARY_DIR}/input_39bus.xml ${CMAKE_CURRENT_BINARY_DIR}/.petscrc ${CMAKE_CURRENT_BINARY_DIR}/case9_PSCAD.raw ${CMAKE_CURRENT_BINARY_DIR}/IEEE39bus.raw ${CMAKE_CURRENT_BINARY_DIR}/case9_GAST.dyr ${CMAKE_CURRENT_BINARY_DIR}/IEEE39bus.dyr ${CMAKE_CURRENT_SOURCE_DIR}/emt_app.cpp DESTINATION share/gridpack/example/emt ) install(TARGETS emt.x DESTINATION bin) ``` -------------------------------- ### Install State Estimation Executable Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/state_estimation/CMakeLists.txt Installs the compiled 'stes.x' executable to the 'bin' directory. ```cmake install(TARGETS stes.x DESTINATION bin) ``` -------------------------------- ### Install Configuration Header Files Source: https://github.com/gridoptics/gridpack/blob/develop/src/configuration/CMakeLists.txt Installs the public header files for the configuration module. ```cmake install(FILES configuration.hpp configurable.hpp no_print.hpp DESTINATION include/gridpack/configuration ) ``` -------------------------------- ### Install Configuration Library Source: https://github.com/gridoptics/gridpack/blob/develop/src/configuration/CMakeLists.txt Installs the built gridpack_configuration library to the destination directory. ```cmake install(TARGETS gridpack_configuration DESTINATION lib ) ``` -------------------------------- ### Install CMake and Pkgconfig Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/MacOSX.md Installs CMake and pkgconfig using MacPorts, which are necessary build tools. ```bash sudo port install cmake sudo port install pkgconfig ``` -------------------------------- ### Build and Install Global Arrays Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/WINDOWS.md Builds the Global Arrays library in Release configuration and then installs it. ```bash cmake --build . --config Release cmake --build . --config Release --target install ``` -------------------------------- ### Compile and Install Global Arrays Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/BASIC_INSTALL.md Compile and install Global Arrays using make with parallel jobs. ```bash make -j 10 install ``` -------------------------------- ### Example EMT Simulation Run Command Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/modules/emt/README.md Provides an example command to run the EMT simulation with the 'input_2bus.xml' configuration file. ```bash ./emt.x input_2bus.xml ``` -------------------------------- ### Install Dynamic Simulation Executables Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/dynamic_simulation_full_y/CMakeLists.txt Installs the compiled dynamic simulation executables (dsf.x and dsf2.x) to the bin directory. ```cmake install(TARGETS dsf.x DESTINATION bin) install(TARGETS dsf2.x DESTINATION bin) ``` -------------------------------- ### Install Serial IO Headers Source: https://github.com/gridoptics/gridpack/blob/develop/src/serial_io/CMakeLists.txt Installs header files for serial I/O and GOSS client into the include directory. ```cmake install(FILES serial_io.hpp #goss_utils.hpp goss_client.hpp DESTINATION include/gridpack/serial_io ) ``` -------------------------------- ### setup Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/sphinx/python/dynamic_simulation.md Sets up the dynamic simulation environment. ```APIDOC ## setup ### Description Sets up the dynamic simulation environment. ### Method `setup(self: gridpack.dynamic_simulation.DSFullApp) -> None` ``` -------------------------------- ### Running GridPACK Installation Script Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/sphinx/Section3-ConfigureBuild.md Execute the script to build the GridPACK framework and its associated applications after dependencies are installed. ```bash install_gridpack.sh ``` -------------------------------- ### Fortran Branch Get Transformer Example Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/tex/fortran.tex Example demonstrating the usage of the branch_compare function within the branch_get_transformer function. ```fortran double complex function branch_get_transformer(branch, bus) : class(application_branch), intent(in) :: branch class(application_bus), intent(in) :: bus class(application_bus), pointer :: bus1, bus2 : if (bus%bus_compare(bus1)) then : ``` -------------------------------- ### Install Sample Application Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/examples/resistor_grid/CMakeLists.txt Configures and installs the resistor_grid application files, including executables, source files, and input data, to a share directory. ```cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.install.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/rg_app.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rg_components.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rg_main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rg_app.hpp ${CMAKE_CURRENT_SOURCE_DIR}/rg_components.hpp ${CMAKE_CURRENT_SOURCE_DIR}/rg_factory.hpp ${CMAKE_CURRENT_SOURCE_DIR}/rg_grid.F90 ${CMAKE_CURRENT_BINARY_DIR}/input.xml ${CMAKE_CURRENT_BINARY_DIR}/small.raw DESTINATION share/gridpack/example/resistor_grid ) ``` -------------------------------- ### Initialize and Start Timing a Category Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/tex/timer.tex Get an instance of the CoarseTimer, create a category for 'Function1', and obtain its integer handle. This prepares the timer to start accumulating time for this category. ```C++ gridpack::utility::CoarseTimer *timer = gridpack::utilitity::CoarseTimer::instance(); int t_func1 = timer->createCategory("Function1"); ``` -------------------------------- ### Get CMake Version Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/required/LINUX_BASICS.md Determine the installed version of CMake. Versions below 3.5.0 may require building a newer version. ```bash cmake -version ``` -------------------------------- ### Bootstrap Boost.Build Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/WINDOWS.md Initiates the Boost.Build system from the downloaded source code. ```bash .\bootstrap.bat ``` -------------------------------- ### Install Boost Static Libraries Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/BASIC_INSTALL.md Install the compiled Boost static libraries to the specified prefix directory. This command follows the staging step. ```bash ./b2 -a -d+2 link=static install ``` -------------------------------- ### Global Arrays Build with Two-Sided MPI Runtime Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/required/GLOBAL_ARRAYS.md Example configuration for building Global Arrays with the basic two-sided MPI runtime. Includes options for integer sizes, C++ support, disabling BLAS, and Fortran, specifying installation prefix and MPI compilers. ```bash ../configure --enable-i4 --enable-cxx --without-blas --disable-f77 \ --prefix=/path/to/my/local/build_ts CC=mpicc CXX=mpicxx \ CFLAGS=-g CXXFLAGS=-g ``` -------------------------------- ### Initialize and Open Configuration Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/tex/configuration.tex Obtain the singleton Configuration instance and open an input file. Requires a GridPACK Communicator. ```C++ gridpack::utility::Configuration * c = gridpack::utility::Configuration::configuration() ; c->open(input_file, comm); ``` -------------------------------- ### Set up GridPACK Build Directory Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/CENTOS7.md Navigate to the GridPACK source directory and create a build directory for the compilation process. ```bash cd $HOME/gridpack/src/GridPACK mkdir src/build cd src/build ``` -------------------------------- ### Initialize Configuration from File Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/sphinx/Section5-FrameworkComponents.md Initializes the singleton Configuration instance by opening an input file. Requires a GridPACK Communicator object. ```default gridpack::utility::Configuration * c = gridpack::utility::Configuration::configuration() ; c->open(input_file, comm); ``` -------------------------------- ### Install GridPACK Dependencies Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/modules/emt/README.md Source the installation script to install all required GridPACK dependencies (Boost, Global Arrays, PETSc). This assumes MPI and CMake are already installed. ```bash source install_gridpack_deps.sh ``` -------------------------------- ### Install Parallel Scripts Source: https://github.com/gridoptics/gridpack/blob/develop/python/src/CMakeLists.txt Installs the defined parallel Python scripts to the 'bin' directory of the installation. ```cmake install( FILES ${parallel_scripts} DESTINATION bin ) ``` -------------------------------- ### Install Timer Library Target Source: https://github.com/gridoptics/gridpack/blob/develop/src/timer/CMakeLists.txt Installs the compiled gridpack_timer library to the 'lib' directory of the installation path. ```cmake install(TARGETS gridpack_timer DESTINATION lib ) ``` -------------------------------- ### Network Setup Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/tex/ds_mod.tex Functions for setting up the network for dynamic simulations. This includes assigning an internal pointer to the network or reading it from a configuration. ```APIDOC ## setNetwork ### Description Assigns an internal pointer to the network for dynamic simulations. Requires a Configuration object pointing to an input file. ### Signature ```cpp void setNetwork(boost::shared_ptr &network, gridpack::utility::Configuration *config) ``` ``` -------------------------------- ### Recommended Main Program Structure Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/tex/environment.tex Illustrates the recommended structure for a main program using the gridpack::Environment object to ensure proper initialization and cleanup. ```C++ int main(int argc, char **argv) { gridpack::Environment env(argc,argv); { // Main body of code goes here } return 0; } ``` -------------------------------- ### Install Target Library Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/components/kds_matrix/CMakeLists.txt Installs the built 'gridpack_kdsmatrix_components' target library to the 'lib' directory within the installation prefix. ```cmake install(TARGETS gridpack_kdsmatrix_components DESTINATION lib ) ``` -------------------------------- ### Set Up Newton-Raphson Iteration Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/tex/developing_apps.tex This snippet shows the setup for the first Newton-Raphson iteration, including defining tolerance and maximum iterations, creating a linear solver, and initializing vectors. ```C++ double tolerance = 1.0e-6; int max_iteration = 100; ComplexType tol; gridpack::math::LinearSolver solver(*J); solver.configure(cursor); int iter = 0; X->zero(); solver.solve(*PQ, *X); tol = PQ->normInfinity(); ``` -------------------------------- ### Example GridPACK Configuration XML Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/tex/cont_analysis.tex An example XML configuration file demonstrating the structure for contingency analysis and power flow settings. ```XML contingencies.xml 2 1.1 0.9 IEEE14_ca.raw 50 1.0e-6 -ksp_type richardson -pc_type lu -pc_factor_mat_solver_package superlu_dist -ksp_max_it 1 ``` -------------------------------- ### initialize Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/sphinx/python/powerflow.md Initialize the power network. `readNetwork()` must be called before this. ```APIDOC ## initialize ### Description Initialize the power network. `readNetwork()` must be called before this. ### Method (Not specified, likely a method call on a Powerflow object) ### Parameters None ### Returns * None ``` -------------------------------- ### Build and Install Global Arrays Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/MacOSX.md Builds and installs the Global Arrays (GA) library using parallel compilation and performs a check of the installation. ```bash make -j make -k check make install ``` -------------------------------- ### Build HTML documentation with Sphinx Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/sphinx/README.md Navigate to the docs/user_manual/sphinx directory and run 'make html' to build the HTML version of the documentation. ```bash make html ``` -------------------------------- ### Test PETSc Installation Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/CENTOS7.md Runs the test suite for the installed PETSc libraries to verify the installation. Uses the configured prefix and an empty architecture for testing. ```shell make PETSC_DIR=$PREFIX/petsc-3.16.3 PETSC_ARCH="" test ``` -------------------------------- ### Bus Table File Format Example Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/tex/bus_table.tex Illustrates the expected format of the input file for the BusTable module, showing bus IDs, device tags, and scenario-specific properties. ```text 11002 BL 0.0011 0.0009 0.0018 0.0023 11003 BL 0.2232 0.2113 0.2202 0.2317 11005 BL 0.1188 0.1076 0.1211 0.1197 11008 BL 0.0053 0.0045 0.0067 0.0072 ``` -------------------------------- ### Build Boost with GCC Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/RC_CLUSTER.md Use this script to configure and build Boost with the GCC toolset. Ensure the --prefix argument points to your desired installation directory. ```bash echo "using mpi ;" > ~/user-config.jam sh ./bootstrap.sh \ --prefix="/pic/projects/gridpack/software_new/boost_1_65_0" \ --without-icu \ --with-toolset=gcc \ --without-libraries=python ./b2 -a -d+2 link=static stage ./b2 -a -d+2 link=static install rm ~/user-config.jam ``` -------------------------------- ### Install Dynamic Simulation Application Files Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/dynamic_simulation_full_y/CMakeLists.txt Installs the necessary configuration files, raw data, dyr files, and source code for the dynamic simulation application to a specific share directory. ```cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.install.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt ${CMAKE_CURRENT_BINARY_DIR}/input_9b3g.xml ${GRIDPACK_DATA_DIR}/raw/9b3g.raw ${GRIDPACK_DATA_DIR}/dyr/9b3g.dyr ${CMAKE_CURRENT_BINARY_DIR}/input_240bus.xml ${GRIDPACK_DATA_DIR}/dyr/240busWECC_2018_PSS_mod.dyr ${GRIDPACK_DATA_DIR}/raw/240busWECC_2018_PSS_fixedshunt.raw ${CMAKE_CURRENT_BINARY_DIR}/input_twoarea.xml ${GRIDPACK_DATA_DIR}/dyr/kundur-twoarea.dyr ${GRIDPACK_DATA_DIR}/raw/kundur-twoarea_v33.raw ${CMAKE_CURRENT_SOURCE_DIR}/dsf_main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dsf_main2.cpp DESTINATION share/gridpack/example/dynamic_simulation_full_y ) ``` -------------------------------- ### Install Mapper Header Files Source: https://github.com/gridoptics/gridpack/blob/develop/src/mapper/CMakeLists.txt Installs the header files for the mapper component to the 'include/gridpack/mapper' directory in the installation prefix. This makes the mapper's public API available to other projects. ```cmake install(FILES bus_vector_map.hpp full_map.hpp gen_matrix_map.hpp gen_vector_map.hpp gen_slab_map.hpp DESTINATION include/gridpack/mapper ) ``` -------------------------------- ### Bootstrap Boost Build Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/BASIC_INSTALL.md Configure the Boost build process, specifying the installation directory and required libraries. Use --prefix to set the installation path and --with-libraries to include specific Boost components. ```bash ./bootstrap.sh --prefix=install_for_gridpack --with-libraries=mpi,serialization,random,filesystem,system ``` -------------------------------- ### Minimal State Estimation Example Source: https://github.com/gridoptics/gridpack/blob/develop/docs/python/state_estimation.md This snippet demonstrates the basic workflow for state estimation using the gridpack library. It includes initialization, reading network and measurement data, solving, and saving results. ```python import gridpack import gridpack.state_estimation env = gridpack.Environment() comm = gridpack.Communicator() config = gridpack.Configuration() config.open(inname, comm) se = gridpack.state_estimation.SEApp() se.readNetwork(config) se.initialize() se.readMeasurements() se.solve() se.saveData() se.write() del se del config del comm del env ``` -------------------------------- ### Install GridPACK Build Dependencies using mk-build-deps Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/UBUNTU.md Installs most of the dependencies required to build GridPACK by creating and installing a virtual package. Run this in the top directory of the cloned GridPACK repository. ```bash sudo mk-build-deps -i ``` -------------------------------- ### Main Program for Hello World Application Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/tex/hello_world.tex This C++ code is the main entry point for the 'Hello World' application. It initializes the parallel environment and instantiates and executes the HWApp class. ```cpp #include "gridpack/include/gridpack.hpp" #include "hw_app.hpp" int main(int argc, char **argv) { gridpack::parallel::Environment env(argc, argv); { gridpack::hello_world::HWApp app; app.execute(argc, argv); } return 0; } ``` -------------------------------- ### Configure LU Solver Input Files Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/dynamic_simulation_full_y/CMakeLists.txt Sets up input files for the LU solver by copying configuration files to the build directory. This is done for multiple simulation scenarios. ```cmake gridpack_set_lu_solver( "${GRIDPACK_DATA_DIR}/input/ds/input_9b3g.xml" "${CMAKE_CURRENT_BINARY_DIR}/input_9b3g.xml" ) gridpack_set_lu_solver( "${GRIDPACK_DATA_DIR}/input/ds/input_240bus.xml" "${CMAKE_CURRENT_BINARY_DIR}/input_240bus.xml" ) gridpack_set_lu_solver( "${GRIDPACK_DATA_DIR}/input/ds/input_twoarea.xml" "${CMAKE_CURRENT_BINARY_DIR}/input_twoarea.xml" ) ``` -------------------------------- ### Install Gridpack Factory Library Source: https://github.com/gridoptics/gridpack/blob/develop/src/factory/CMakeLists.txt Installs the gridpack_factory library to the lib directory. ```cmake install(TARGETS gridpack_factory DESTINATION lib ) ``` -------------------------------- ### Install Hadrec Executable Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/hadrec/CMakeLists.txt Installs the compiled hadrec.x executable to the 'bin' directory. ```cmake install(TARGETS hadrec.x DESTINATION bin) ``` -------------------------------- ### Add Executable Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/examples/hello_world/CMakeLists.txt Defines the main executable target 'hello_world.x' and lists its source files. ```cmake add_executable(hello_world.x hw_app.cpp hw_components.cpp hw_main.cpp ) ``` -------------------------------- ### Build Boost Libraries Source: https://github.com/gridoptics/gridpack/blob/develop/docs/notes/Theta.txt Commands to bootstrap, build, and install Boost libraries using the configured settings. It specifies static linking and a target installation directory. ```bash sh ./bootstrap.sh \ --prefix="/home/bjpalmer/software/boost_1_61_0" \ --without-icu \ --with-toolset=gcc \ --without-libraries=python ./b2 -a -d+2 link=static stage ./b2 -a -d+2 link=static install rm -f ~/user-config.jam ``` -------------------------------- ### Install Library Target Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/components/pf_matrix/CMakeLists.txt Installs the built 'gridpack_pfmatrix_components' library to the 'lib' directory. ```cmake install(TARGETS gridpack_pfmatrix_components DESTINATION lib ) ``` -------------------------------- ### Configure and Build Boost 1.55.0 Source: https://github.com/gridoptics/gridpack/blob/develop/docs/notes/BlueWaters.txt Configure and build Boost library version 1.55.0 using a Jamroot configuration file and the b2 build tool. This example specifies static linking and GCC toolset. ```bash cat << EOF > ~/user-config.jam using mpi : : mpich ; using gcc : : : -I${MPICH_DIR}/include -L${MPICH_DIR}/lib ; EOF sh ./bootstrap.sh \ --prefix=$HOME/software/boost_1_55_0 \ --without-icu \ --with-toolset=gcc \ --without-libraries=python ./b2 -a -d+2 link=static stage ./b2 -a -d+2 link=static install rm -f ~/user-config.jam ``` -------------------------------- ### Install GridPACK Source: https://github.com/gridoptics/gridpack/blob/develop/docs/markdown/platforms/WINDOWS.md Installs the GridPACK project in Release configuration using CMake. ```bash cmake --build . --config Release --target install ``` -------------------------------- ### Install GridPACK Components Library Source: https://github.com/gridoptics/gridpack/blob/develop/src/component/CMakeLists.txt Installs the compiled gridpack_components library to the destination directory. ```cmake install(TARGETS gridpack_components DESTINATION lib ) ``` -------------------------------- ### Instantiating DAESolver with Helper Functors Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/tex/math.tex Demonstrates how to create a DAESolver instance using a custom helper functor and boost::ref. ```C++ gridpack::parallel::Communicator comm; MyDAEHelper myhelper; DAESolver::JacobianBuilder jbuilder = boost::ref(myhelper); DAESolver::FunctionBuilder fbuilder = boost::ref(myhelper); DAESolver solver(comm, lrows, jbuilder, fbuilder); ``` -------------------------------- ### Install Factory Header Files Source: https://github.com/gridoptics/gridpack/blob/develop/src/factory/CMakeLists.txt Installs the base_factory.hpp header file to the include/gridpack/factory directory. ```cmake install(FILES base_factory.hpp DESTINATION include/gridpack/factory ) ``` -------------------------------- ### DAESolver Pre and Post Step Functions Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/sphinx/Section5-FrameworkComponents.md Example of setting pre-step and post-step functions for DAESolver to manipulate or report on solver progression. ```cpp struct MyDAEHelper { [...] void operator() (const double& time); static void postTimeStep (const double& time); }; [...] DAESolver::StepFunction sfunc; sfunc = boost::ref(myhelper); solver.preStep(sfunc); sfunc = &MyDAEHelper::postTimeStep; solver.postStep(sfunc); ``` -------------------------------- ### Install Powerflow Module Library Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/modules/powerflow/CMakeLists.txt Installs the compiled 'gridpack_powerflow_module' library to the 'lib' directory. ```cmake install(TARGETS gridpack_powerflow_module DESTINATION lib ) ``` -------------------------------- ### Install Contingency Analysis Executable Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/contingency_analysis/CMakeLists.txt Installs the contingency analysis executable to the bin directory. ```cmake install(TARGETS ca.x DESTINATION bin) ``` -------------------------------- ### Install ds_matrix Library Target Source: https://github.com/gridoptics/gridpack/blob/develop/src/applications/components/ds_matrix/CMakeLists.txt Installs the built gridpack_dsmatrix_components library to the 'lib' destination. ```cmake install(TARGETS gridpack_dsmatrix_components DESTINATION lib ) ``` -------------------------------- ### Install Sphinx on macOS with Homebrew Source: https://github.com/gridoptics/gridpack/blob/develop/docs/user_manual/sphinx/README.md Install the sphinx-doc package using Homebrew on a Mac. ```bash brew install sphinx-doc ```