From bd69a53d80bb9dd405ae81a0bfcaba0d9ef78ed0 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Mon, 28 Aug 2023 18:02:20 -0600 Subject: [PATCH 1/4] fix docs tom file --- docs/Project.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Project.toml b/docs/Project.toml index 797ccdb3..f448ac29 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -2,6 +2,8 @@ DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" PowerNetworkMatrices = "bed98974-b02a-5e2f-9fe0-a103f5c450dd" +PowerSystemCaseBuilder = "f00506e0-b84f-492a-93c2-c0a9afc4364e" +PowerSystems = "bcd98974-b02a-5e2f-9ee0-a103f5c450dd" [compat] Documenter = "^0.27" From b3eca742dd74226db54f34b4a326afab4fd4df28 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Mon, 28 Aug 2023 18:03:36 -0600 Subject: [PATCH 2/4] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e4ad0ac7..c8511be8 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![PowerNetworkMatrices.jl Downloads](https://shields.io/endpoint?url=https://pkgs.genieframework.com/api/v1/badge/PowerNetworkMatrices)](https://pkgs.genieframework.com?packages=PowerNetworkMatrices) `PowerNetworkMatrices.jl` is able to build classic power systems modeling network matrices such as -[Ybus](https://en.wikipedia.org/wiki/Nodal_admittance_matrix), [PTDF](https://www.powerworld.com/WebHelp/Content/MainDocumentation_HTML/Power_Transfer_Distribution_Factors.htm) and LODF. +[Ybus](https://en.wikipedia.org/wiki/Nodal_admittance_matrix), [PTDF](https://www.powerworld.com/WebHelp/Content/MainDocumentation_HTML/Power_Transfer_Distribution_Factors.htm) and [LODF](https://www.powerworld.com/WebHelp/Content/MainDocumentation_HTML/Line_Outage_Distribution_Factors_LODFs.htm#:~:text=Line%20Outage%20Distribution%20Factors%20(LODFs)%20are%20a%20sensitivity%20measure%20of,other%20lines%20in%20the%20system.). ## Version Advisory From 521ad3e713ed0def370a9adbe1a79cfcaeb12cfc Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Mon, 28 Aug 2023 18:07:53 -0600 Subject: [PATCH 3/4] minor fixes --- docs/src/index.md | 6 ++-- .../tutorial_Incidence_BA_ABA_matrices.md | 34 +++++++++---------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index c4b3a227..9c6a3b7f 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -7,7 +7,7 @@ CurrentModule = PowerNetworkMatrices ## Overview `PowerNetworkMatrices.jl` is a [`Julia`](http://www.julialang.org) package for -the evaluation of network matrices given the system's data. The package allows to compute +the evaluation of network matrices given the system's data. The package allows to compute the matrices according to different methods, providing a flexibe and powerful tool. The documentation and code are organized according to the needs of different @@ -37,6 +37,4 @@ For the current development version, "checkout" this package with ``` ------------ -PowerNetworkMatrices has been developed as part of the Scalable Integrated Infrastructure Planning -(SIIP) initiative at the U.S. Department of Energy's National Renewable Energy -Laboratory ([NREL](https://www.nrel.gov/)). +PowerNetworkMatrices has been developed as part of the Scalable Integrated Infrastructure Planning (SIIP) initiative at the U.S. Department of Energy's National Renewable Energy Laboratory ([NREL](https://www.nrel.gov/)). diff --git a/docs/src/tutorials/tutorial_Incidence_BA_ABA_matrices.md b/docs/src/tutorials/tutorial_Incidence_BA_ABA_matrices.md index ee7c215e..c4cd49f1 100644 --- a/docs/src/tutorials/tutorial_Incidence_BA_ABA_matrices.md +++ b/docs/src/tutorials/tutorial_Incidence_BA_ABA_matrices.md @@ -1,14 +1,14 @@ # Incidence, BA and ABA matrices -In this tutorial the `IncidenceMatrix`, `BA_matrix` and `ABA_matrix` are presented. -The methods used for their evaluation, as well as how data is stored is shown in +In this tutorial the `IncidenceMatrix`, `BA_matrix` and `ABA_matrix` are presented. +The methods used for their evaluation, as well as how data is stored is shown in the following subsections. The matrices here presented are the building blocks for the compuation of the PTDF and LODF matrices. ## IncidenceMatrix -The `PowerNetworkMatrices` package defines the structure `IncidenceMatrix`, which +The `PowerNetworkMatrices` package defines the structure `IncidenceMatrix`, which store the Incidence Matrix of the considered system as well as the most relevant network data. At first, the `System` data is loaded. @@ -29,7 +29,7 @@ Then the Incidence Matrix is computed as follows: incidence_matrix = PNM.IncidenceMatrix(sys); ``` -The `incidence_matrix` variable is a structure of type `IncidenceMatrix` +The `incidence_matrix` variable is a structure of type `IncidenceMatrix` featuring the following fields: ``` @repl tutorial_Incidence_BA_ABA_matrices @@ -41,12 +41,12 @@ incidence_matrix.axes # data: Incidence Matrix incidence_matrix.data -# lookup: dictionary linking the branche names and bus numbers with the row +# lookup: dictionary linking the branche names and bus numbers with the row # and column numbers, respectively. incidence_matrix.axes # ref_bus_positions: set containing the positions of the reference buses. -# this represents the positions where to add the column of zeros. Please refer to the +# this represents the positions where to add the column of zeros. Please refer to the # exaple in the BA matrix for more details. incidence_matrix.ref_bus_positions ``` @@ -57,7 +57,7 @@ Please note that the matrix data can be easily access by using the following fun PNM.get_data(incidence_matrix) ``` -Note that the number of columns is lower than the actual number of system buses since +Note that the number of columns is lower than the actual number of system buses since the column related to the reference bus is discarded. ## BA_Matrix @@ -81,27 +81,27 @@ ba_matrix.data # or by using the "get_data" function PNM.get_data(ba_matrix) ``` -Note that the number of columns is lower than the actual number of system buses since +Note that the number of columns is lower than the actual number of system buses since the column related to the reference bus is discarded. -To add the column of zeros related to the reference bus, it is necessary to use the +To add the column of zeros related to the reference bus, it is necessary to use the information contained in the `ref_bus_positions` field. ``` @repl tutorial_Incidence_BA_ABA_matrices new_ba_matrix = hcat( - ba_matrix.data[:,1:collect(ba_matrix.ref_bus_positions)[1]-1], - zeros(size(ba_matrix, 1), 1), + ba_matrix.data[:,1:collect(ba_matrix.ref_bus_positions)[1]-1], + zeros(size(ba_matrix, 1), 1), ba_matrix.data[:, collect(ba_matrix.ref_bus_positions)[1]:end] ) ``` -However, trying to change the data field with a matrix of different dimension +However, trying to change the data field with a matrix of different dimension will result in an error. ``` @repl tutorial_Incidence_BA_ABA_matrices ba_matrix.data = hcat( - ba_matrix.data[:,1:collect(ba_matrix.ref_bus_positions)[1]-1], - zeros(size(ba_matrix, 1), 1), + ba_matrix.data[:,1:collect(ba_matrix.ref_bus_positions)[1]-1], + zeros(size(ba_matrix, 1), 1), ba_matrix.data[:, collect(ba_matrix.ref_bus_positions)[1]:end] ) ``` @@ -112,7 +112,7 @@ ba_matrix.data = hcat( The `ABA_Matrix` is a structure containing the matrix coming from the product of the `IncidenceMatrix` and the `BA_Matrix`. It features the same fields as the `IncidenceMatrix` and the `BA_Matrix`, plus the `K` one. -The field `ABA_Matrix.K` stores the LU factorization matrices (using the +The field `ABA_Matrix.K` stores the LU factorization matrices (using the methods contained in the package `KLU`). To evaluate the `ABA_Matrix`, the following command is sufficient: @@ -141,5 +141,5 @@ aba_matrix.K The following command can then be used to check if the `ABA_Matrix` contains the LU factorization matrices: ``` @repl tutorial_Incidence_BA_ABA_matrices -is_factorized(aba_matrix_new) -``` \ No newline at end of file +is_factorized(aba_matrix) +``` From 589836a0fca932065f8dc0556e71d9fe86d40254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Henr=C3=ADquez-Auba?= Date: Mon, 28 Aug 2023 22:47:14 -0400 Subject: [PATCH 4/4] update typos (#53) --- docs/src/index.md | 2 +- .../tutorials/tutorial_Incidence_BA_ABA_matrices.md | 6 +++--- docs/src/tutorials/tutorial_LODF_matrix.md | 6 +++--- docs/src/tutorials/tutorial_PTDF_matrix.md | 8 ++++---- docs/src/tutorials/tutorial_VirtualLODF_matrix.md | 10 +++++----- docs/src/tutorials/tutorial_VirtualPTDF_matrix.md | 10 +++++----- src/virtual_ptdf_calculations.jl | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index 9c6a3b7f..dfa66f5c 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -8,7 +8,7 @@ CurrentModule = PowerNetworkMatrices `PowerNetworkMatrices.jl` is a [`Julia`](http://www.julialang.org) package for the evaluation of network matrices given the system's data. The package allows to compute -the matrices according to different methods, providing a flexibe and powerful tool. +the matrices according to different methods, providing a flexible and powerful tool. The documentation and code are organized according to the needs of different users depending on their skillset and requirements. In broad terms there are three categories: diff --git a/docs/src/tutorials/tutorial_Incidence_BA_ABA_matrices.md b/docs/src/tutorials/tutorial_Incidence_BA_ABA_matrices.md index c4cd49f1..806cb5cc 100644 --- a/docs/src/tutorials/tutorial_Incidence_BA_ABA_matrices.md +++ b/docs/src/tutorials/tutorial_Incidence_BA_ABA_matrices.md @@ -41,13 +41,13 @@ incidence_matrix.axes # data: Incidence Matrix incidence_matrix.data -# lookup: dictionary linking the branche names and bus numbers with the row +# lookup: dictionary linking the branches names and bus numbers with the row # and column numbers, respectively. incidence_matrix.axes # ref_bus_positions: set containing the positions of the reference buses. # this represents the positions where to add the column of zeros. Please refer to the -# exaple in the BA matrix for more details. +# example in the BA matrix for more details. incidence_matrix.ref_bus_positions ``` @@ -63,7 +63,7 @@ the column related to the reference bus is discarded. ## BA_Matrix The `BA_Matrix` is a structure containing the matrix coming from the product of the -`IncidenceMatrix` and the diagonal matrix contianing the impedence of the system's branches ("B" matrix). +`IncidenceMatrix` and the diagonal matrix containing the impedence of the system's branches ("B" matrix). The `BA_Matrix` is computed as follows: diff --git a/docs/src/tutorials/tutorial_LODF_matrix.md b/docs/src/tutorials/tutorial_LODF_matrix.md index 348edc35..303b6494 100644 --- a/docs/src/tutorials/tutorial_LODF_matrix.md +++ b/docs/src/tutorials/tutorial_LODF_matrix.md @@ -7,7 +7,7 @@ Before diving into this tutorial we encourage the user to load `PowerNetworkMatr As for the `PTDF` matrix, the `LODF` one can be evaluated according to two different approaches: - `Dense`: considers functions for dense matrix multiplication and inversion -- `KLU`: considers functions for sparse matrix multiplication and inversion(**default**) +- `KLU`: considers functions for sparse matrix multiplication and inversion (**default**) The evaluation of the `LODF` matrix can be easily performed starting from importing the system's data and then by simply calling the `LODF` method. @@ -69,7 +69,7 @@ lodf_5 = LODF(a, aba, ba); For those methods that either require the evaluation of the `PTDF` matrix, or that execute this evaluation internally, two different approaches casen be used. -As for the `PTDF` matrix, here too the optional argument `linear_solver` can be specified with either `KLU` (for spars matrix calculation) or `Dense` (for sparse matrix calculation). +As for the `PTDF` matrix, here too the optional argument `linear_solver` can be specified with either `KLU` (for sparse matrix calculation) or `Dense` (for sparse matrix calculation). ``` @repl tutorial_PTDF_matrix lodf_dense = LODF(sys, linear_solver="Dense"); @@ -97,4 +97,4 @@ Please consider that 0.4 was used for the purpose of this tutorial. In practice **NOTE (2):** the `tol` argument does not refer to the "sparsification" tolerance of the `PTDF` matrix that is computed in the `LODF` method. -**NOTE (3):** in case the method `LODF(a::IncidenceMatrix, ptdf::PTDF)` is considerd, an error will be thrown whenever the `tol` argument in the `PTDF` structure used as input is different then 1e-15. \ No newline at end of file +**NOTE (3):** in case the method `LODF(a::IncidenceMatrix, ptdf::PTDF)` is considered, an error will be thrown whenever the `tol` argument in the `PTDF` structure used as input is different than `1e-15`. \ No newline at end of file diff --git a/docs/src/tutorials/tutorial_PTDF_matrix.md b/docs/src/tutorials/tutorial_PTDF_matrix.md index ac286691..47603692 100644 --- a/docs/src/tutorials/tutorial_PTDF_matrix.md +++ b/docs/src/tutorials/tutorial_PTDF_matrix.md @@ -1,7 +1,7 @@ # PTDF matrix In this tutorial the methods for computing the Power Transfer Distribution Factors (`PTDF`) are presented. -Before diving into this tutorial we encourage the user to load `PowerNetworkMatrices`, hit the `?` key in the REPL terminal and look for the documentiont of the different `PTDF` methods avialable. +Before diving into this tutorial we encourage the user to load `PowerNetworkMatrices`, hit the `?` key in the REPL terminal and look for the documention of the different `PTDF` methods available. ## Evaluation of the `PTDF` matrix @@ -59,11 +59,11 @@ get_ptdf_data(ptdf_klu) ``` By default the "KLU" method is selected, which appeared to require significant less time and memory with respect to "Dense". -Please note that either the `KLU` or `Dense` method isi used, the resultig `PTDF` matrix is stored as a dense one. +Please note that either the `KLU` or `Dense` method is used, the resulting `PTDF` matrix is stored as a dense one. ## Evaluating the `PTDF` matrix considering distributed slack bus -Whenever needed, the `PTDF` matrix can be computed with a distributed slack bus. To do so, a vecotr of type `Vector{Float64}` needs to be defined, specifying the weights for each bus of the system. These weights identify how the load on the slakc bus is redistributed accross the system. +Whenever needed, the `PTDF` matrix can be computed with a distributed slack bus. To do so, a vector of type `Vector{Float64}` needs to be defined, specifying the weights for each bus of the system. These weights identify how the load on the slakc bus is redistributed accross the system. ``` @repl tutorial_PTDF_matrix # consider equal distribution accross each bus for this example @@ -78,7 +78,7 @@ Once the vector of the weights is defined, the `PTDF` matrix can be computed by ptdf_distr = PTDF(sys, dist_slack=dist_slack_array); ``` -The diffrence between a the matrix computed with and without the `dist_slack` field defined can be seen as follows: +The difference between a the matrix computed with and without the `dist_slack` field defined can be seen as follows: ``` @repl tutorial_PTDF_matrix # with no distributed slack bus diff --git a/docs/src/tutorials/tutorial_VirtualLODF_matrix.md b/docs/src/tutorials/tutorial_VirtualLODF_matrix.md index 803feddc..20567227 100644 --- a/docs/src/tutorials/tutorial_VirtualLODF_matrix.md +++ b/docs/src/tutorials/tutorial_VirtualLODF_matrix.md @@ -8,7 +8,7 @@ Refer to the different arguments of the `VirtualLODF` methods by looking at the The `VirtualLODF` structure retains many of the similarities of the `VirtualPTDF`. However, its computation is more complex and requires some additional data. -Starting from the system data, the `IncidenceMatrix`, `BA_Matrix` and `ABA_Matrix` (with relative LU factorization matrices) are evaluated. The `ABA_Matrix` and `BA_Matrix` are used for the computation of the diagonal elements of the `PTDF` matrix, and this vector is stored in the `VirtualLODF` structure together with the other structures abovementioned. +Starting from the system data, the `IncidenceMatrix`, `BA_Matrix` and `ABA_Matrix` (with relative LU factorization matrices) are evaluated. The `ABA_Matrix` and `BA_Matrix` are used for the computation of the diagonal elements of the `PTDF` matrix, and this vector is stored in the `VirtualLODF` structure together with the other structures mentioned above. Once the `VirtualLODF` is initialized, each row of the matrix can be evaluated separately and on user request. The algorithmic procedure is the following: 1. Define the `VirtualPTDF` structure @@ -19,12 +19,12 @@ Regarding point 2, if the row has been stored previosly then the desired element The flowchart below shows how the `VirtualLODF` is structured and how it works. Examples will be presented in the following sections. ```@raw html - + ``` ## Initialize `VirtualLODF` and compute/access row/element -As for the `LODF` matrix, at first the `System` data must be loaded. The "RTS GMLC" systems is considered as example: +As for the `LODF` matrix, at first the `System` data must be loaded. The "RTS-GMLC" systems is considered as example: ``` @repl tutorial_VirtualPTDF_matrix using PowerNetworkMatrices @@ -58,9 +58,9 @@ col_number = v_lodf.lookup[2]["A3"] el_C31_2_105_bis = v_lodf[row_number, col_number] ``` -**NOTE**: this example was made for the sake of completeness and considering the actual branch names is reccomended. +**NOTE**: this example was made for the sake of completeness and considering the actual branch names is recommended. -As previosly mentioned, in order to evalute a single element of the `VirtualLODF`, the entire row related to the selected branch must be considered. For this reason it is cached for later calls. +As previosly mentioned, in order to evaluate a single element of the `VirtualLODF`, the entire row related to the selected branch must be considered. For this reason it is cached for later calls. This is evident by looking at the following example: ``` @repl tutorial_VirtualPTDF_matrix diff --git a/docs/src/tutorials/tutorial_VirtualPTDF_matrix.md b/docs/src/tutorials/tutorial_VirtualPTDF_matrix.md index 7afcb5d6..443a6568 100644 --- a/docs/src/tutorials/tutorial_VirtualPTDF_matrix.md +++ b/docs/src/tutorials/tutorial_VirtualPTDF_matrix.md @@ -18,12 +18,12 @@ Regarding point 2, if the row has been stored previosly then the desired element The flowchart below shows how the `VirtualPTDF` is structured and how it works. Examples will be presented in the following sections. ```@raw html - + ``` ## Initialize `VirtualPTDF` and compute/access row/element -As for the `PTDF` matrix, at first the `System` data must be loaded. The "RTS GMLC" systems is considered as example: +As for the `PTDF` matrix, at first the `System` data must be loaded. The "RTS-GMLC" systems is considered as example: ``` @repl tutorial_VirtualPTDF_matrix using PowerNetworkMatrices @@ -57,7 +57,7 @@ el_C31_2_105_bis = v_ptdf[row_number, col_number] **NOTE**: this example was made for the sake of completeness and considering the actual branch name and bus number is reccomended. -As previosly mentioned, in order to evalute a single element of the `VirtualPTDF`, the entire row related to the selected branch must be considered. For this reason it is cached in the `VirtualPTDF` structure for later calls. +As previosly mentioned, in order to evaluate a single element of the `VirtualPTDF`, the entire row related to the selected branch must be considered. For this reason it is cached in the `VirtualPTDF` structure for later calls. This is evident by looking at the following example: ``` @repl tutorial_VirtualPTDF_matrix @@ -75,7 +75,7 @@ v_ptdf_2k = VirtualPTDF(sys_2k); ## `VirtualPTDF` with distributed slack bus As for the `PTDF` matrix, here too each row can be evaluated considering distibuted slack buses. -A vecotr of type `Vector{Float64}` is defined, specifying the weights for each bus of the system. +A vector of type `Vector{Float64}` is defined, specifying the weights for each bus of the system. ``` @repl tutorial_VirtualPTDF_matrix # smaller system for the next examples @@ -94,7 +94,7 @@ v_ptdf_distr = VirtualPTDF(sys_2, dist_slack=dist_slack_array); v_ptdf_orig = VirtualPTDF(sys_2); ``` -Now check the difference with the same row related to the branch `"1"` evaluated withou considering distributed slack bus. +Now check the difference with the same row related to the branch `"1"` evaluated without considering distributed slack bus. ``` @repl tutorial_VirtualPTDF_matrix row_distr = [v_ptdf_distr["1", j] for j in v_ptdf_distr.axes[2]] diff --git a/src/virtual_ptdf_calculations.jl b/src/virtual_ptdf_calculations.jl index 13deeee3..afc37c7e 100644 --- a/src/virtual_ptdf_calculations.jl +++ b/src/virtual_ptdf_calculations.jl @@ -24,7 +24,7 @@ matrix. - `axes<:NTuple{2, Dict}`: Tuple containing two vectors: the first one showing the branches names, the second showing the buses numbers. There is no link between the - order of the vector of the branche names and the way the PTDF rows are + order of the vector of the branches names and the way the PTDF rows are stored in the cache. - `lookup<:NTuple{2, Dict}`: Tuple containing two dictionaries, mapping the branches