Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Jd/init dev #48

Merged
merged 84 commits into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
9121ace
move to solve all injections first
jd-lara Mar 6, 2020
f2f9c06
move to solve all injections first
jd-lara Mar 6, 2020
acf2965
Merge branch 'jd/dynamic_branch_refactoring' of https://github.com/En…
jd-lara Mar 7, 2020
af08aa3
whitespace change
jd-lara Mar 7, 2020
6d2b606
WIP: enable small signal with Dynamic Line present
jd-lara Mar 7, 2020
186fc35
move to solve all injections first
jd-lara Mar 6, 2020
cdbbba4
whitespace change
jd-lara Mar 7, 2020
52e381c
WIP: enable small signal with Dynamic Line present
jd-lara Mar 7, 2020
e08f9be
Merge branch 'jd/dynamic_branch_refactoring' of https://github.com/En…
jd-lara Mar 12, 2020
25951d5
update indexing
jd-lara Mar 19, 2020
912aadf
get unique voltages
jd-lara Mar 19, 2020
071c631
update indexing
jd-lara Mar 20, 2020
bd04d53
correct calculation in assert
jd-lara Mar 20, 2020
15e0676
minor updates
jd-lara Mar 20, 2020
4497de7
remove voltages from line models
jd-lara Mar 20, 2020
b8e5291
change storage of voltage nodes
jd-lara Mar 20, 2020
ba7058e
don't pass dx to line
jd-lara Mar 20, 2020
15b119d
update system
jd-lara Mar 20, 2020
f9861d9
fix bad indexing into Kirchoff laws
jd-lara Mar 20, 2020
ebac0bf
remove unncesary comment
jd-lara Mar 20, 2020
33dcee2
whitespace
jd-lara Mar 20, 2020
f123650
use const strings in dicts
jd-lara Mar 20, 2020
f9bb4bd
Fix Test Case 9
rodrigomha Mar 20, 2020
6aadd42
Fix test8
rodrigomha Mar 20, 2020
ad89487
Merge pull request #42 from Energy-MAC/rh/updates_dynbranch_refactoring
jd-lara Mar 20, 2020
8360be6
use inmmutable dicts
jd-lara Mar 20, 2020
ce5b518
update branch models
jd-lara Mar 20, 2020
e4e2cd1
Merge branch 'jd/dynamic_branch_refactoring' of https://github.com/En…
jd-lara Mar 20, 2020
d493dc9
whitespace
jd-lara Mar 20, 2020
d8784e5
indexing in small signal analysis for dynbranch
rodrigomha Mar 20, 2020
c3852b6
Merge pull request #43 from Energy-MAC/rh/update_small_signal
jd-lara Mar 21, 2020
5744df2
improve kirchoff laws
jd-lara Mar 23, 2020
3d06e76
make definitions more clear
jd-lara Mar 23, 2020
7d5626b
whitespace fixes
jd-lara Mar 23, 2020
59d3877
Merge pull request #41 from Energy-MAC/jd/dynamic_branch_refactoring
jd-lara Mar 23, 2020
96dc217
Update Project.toml
jd-lara Mar 27, 2020
e9b41d1
update psy version
jd-lara Apr 3, 2020
f1f5fd0
update inner vars
rodrigomha Apr 5, 2020
88038a0
update ports
rodrigomha Apr 5, 2020
5eac4ec
update models to match new PSY structs
rodrigomha Apr 5, 2020
6a09394
update data
rodrigomha Apr 5, 2020
0daedee
update LITS
rodrigomha Apr 5, 2020
4b933d2
update tests
rodrigomha Apr 5, 2020
16b24d1
update naming in converter models
rodrigomha Apr 5, 2020
a29a038
fix ports and inner vars
rodrigomha Apr 5, 2020
56f667f
switch order PLL and OuterLoop
rodrigomha Apr 5, 2020
40a8a18
update docs
rodrigomha Apr 5, 2020
08bcc6d
formatting updates
rodrigomha Apr 5, 2020
5dbaa1d
update documentation typo
rodrigomha Apr 5, 2020
2d4d056
update toml files
jd-lara Apr 8, 2020
6410597
update inner vars to real
rodrigomha Apr 8, 2020
4ace12a
fix typos inner and outer modules
rodrigomha Apr 8, 2020
e474154
update project.toml
rodrigomha Apr 8, 2020
99eba9a
reduce IS dependency
jd-lara Apr 8, 2020
75bf875
Merge pull request #47 from Energy-MAC/jd/dependencies_updates
jd-lara Apr 8, 2020
1e69d28
Merge branch 'master' into jd/name_updates
jd-lara Apr 8, 2020
b47f2a8
creating branch for init cond
ciaranrob Mar 18, 2020
046e96d
creating branch for init cond
ciaranrob Mar 18, 2020
34aa0d6
grid following initial conditions
egarbiec Mar 20, 2020
fbb1df0
grid forming initial conditions
egarbiec Mar 20, 2020
c369515
Update grid_forming.ipynb
egarbiec Apr 3, 2020
43b19b0
Update grid_forming.ipynb
egarbiec Apr 9, 2020
ec41aa5
Update grid_forming.ipynb
egarbiec Apr 9, 2020
bab2584
Update grid_following.ipynb
egarbiec Apr 9, 2020
01e779e
Update Twogen2bus.m
egarbiec Apr 9, 2020
dd4aede
Adding refernce frame conversion to code
ciaranrob Apr 10, 2020
a1c2f93
Adding reactive power constraint
ciaranrob Apr 13, 2020
6796452
Update grid_following.ipynb
egarbiec Apr 11, 2020
a45f22c
creating branch for init cond
ciaranrob Mar 18, 2020
aea59f0
creating branch for init cond
ciaranrob Mar 18, 2020
d7f9aec
grid following initial conditions
egarbiec Mar 20, 2020
6ba9b47
grid forming initial conditions
egarbiec Mar 20, 2020
ae179cb
Update grid_forming.ipynb
egarbiec Apr 3, 2020
304e190
Update grid_forming.ipynb
egarbiec Apr 9, 2020
2a038b8
Update grid_forming.ipynb
egarbiec Apr 9, 2020
401365d
Update grid_following.ipynb
egarbiec Apr 9, 2020
fac22fe
Update Twogen2bus.m
egarbiec Apr 9, 2020
c5e1e8a
Adding refernce frame conversion to code
ciaranrob Apr 10, 2020
3039921
Adding reactive power constraint
ciaranrob Apr 13, 2020
7ccd6c9
Update grid_following.ipynb
egarbiec Apr 11, 2020
a38a45e
Merge branch 'jd/init_dev' of https://github.com/Energy-MAC/LITS.jl i…
jd-lara Apr 13, 2020
07bc4fd
correct bad value
jd-lara Apr 13, 2020
a188bcc
add power flow solution from PSY
jd-lara Apr 13, 2020
97f11e2
Merge branch 'init_dev' into jd/init_dev
jd-lara Apr 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "LITS"
uuid = "86b0dc02-7903-11e9-325f-f195ca7e6c1a"
version = "0.3.1"
version = "0.4.0"

[deps]
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
Expand All @@ -11,11 +11,10 @@ NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
PowerSystems = "bcd98974-b02a-5e2f-9ee0-a103f5c450dd"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"


[compat]
DiffEqBase = "6"
ForwardDiff = "~v0.10"
InfrastructureSystems = "~0.5"
InfrastructureSystems = "~0.6"
NLsolve = "4"
PowerSystems = "~0.11"
PowerSystems = "~0.14"
julia = "^1.2"
2 changes: 1 addition & 1 deletion dev_files/init_cond/Twogen2bus.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
%% generator data
% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf
mpc.gen = [
1 700 70 100 -100 1.02 1000 1000 1000 0 0 0 0 0 0 0 0 0 0 0;
1 700 70 100 -100 1.02 1000 1 1000 0 0 0 0 0 0 0 0 0 0 0;
%2 50 -30 100 -100 1.0 100 1 150 37.5 0 0 0 0 0 0 0 0 0 0 0;
];

Expand Down
155 changes: 137 additions & 18 deletions dev_files/init_cond/initial_conditions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,156 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"PowerSystems"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"using Revise\n",
"using PowerModels\n",
"using Ipopt\n",
"using ForwardDiff\n",
"using OrdinaryDiffEq\n",
"using NLsolve"
"#using OrdinaryDiffEq\n",
"using NLsolve\n",
"using PowerSystems\n",
"const PSY = PowerSystems"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<style>.container { width:100% !important; }</style>"
],
"text/plain": [
"HTML{String}(\"<style>.container { width:100% !important; }</style>\")"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display(HTML(\"<style>.container { width:100% !important; }</style>\"))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"outputs": [],
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"┌ Info: Constructing System from Power Models\n",
"│ data[\"name\"] = Twogen2bus\n",
"│ data[\"source_type\"] = matpower\n",
"└ @ PowerSystems /Users/jdlara/.julia/packages/PowerSystems/wHSk9/src/parsers/power_models_data.jl:33\n",
"┌ Info: Reading bus data\n",
"└ @ PowerSystems /Users/jdlara/.julia/packages/PowerSystems/wHSk9/src/parsers/power_models_data.jl:122\n",
"┌ Info: Reading generator data\n",
"└ @ PowerSystems /Users/jdlara/.julia/packages/PowerSystems/wHSk9/src/parsers/power_models_data.jl:368\n",
"┌ Warning: Generator cost data not included for Generator: gen-1-1\n",
"└ @ PowerSystems /Users/jdlara/.julia/packages/PowerSystems/wHSk9/src/parsers/power_models_data.jl:330\n",
"┌ Info: Reading branch data\n",
"└ @ PowerSystems /Users/jdlara/.julia/packages/PowerSystems/wHSk9/src/parsers/power_models_data.jl:520\n",
"┌ Warning: Rate provided for 1 is 32.0, larger the SIL 258.94053053874836 in the range of (min = 325.0, max = 425.0).\n",
"└ @ PowerSystems /Users/jdlara/.julia/packages/PowerSystems/wHSk9/src/utils/IO/branchdata_checks.jl:150\n",
"┌ Info: Reading branch data\n",
"└ @ PowerSystems /Users/jdlara/.julia/packages/PowerSystems/wHSk9/src/parsers/power_models_data.jl:583\n",
"┌ Info: Reading DC Line data\n",
"└ @ PowerSystems /Users/jdlara/.julia/packages/PowerSystems/wHSk9/src/parsers/power_models_data.jl:554\n",
"┌ Info: PowerFlow solve converged, the results have been stored in the system\n",
"└ @ PowerSystems /Users/jdlara/.julia/packages/PowerSystems/wHSk9/src/utils/power_flow/power_flow.jl:147\n"
]
},
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"file_dir = joinpath(pwd(), \"Twogen2bus.m\")\n",
"sys = System(PSY.PowerModelsData(file_dir))\n",
"solve_powerflow!(sys, nlsolve, method = :newton)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Vm = 1.02 Va= 0.0\n",
"Vm = 1.0 Va= -0.1279338657728345\n"
]
}
],
"source": [
"for b in get_components(Bus, sys)\n",
" println(\"Vm = $(get_voltage(b))\", \" \",\"Va= $(get_angle(b))\")\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1mMetadata\u001b[0m\n",
" baseMVA: 1000\n",
" per_unit: true\n",
"\n",
"\u001b[1mTable Counts\u001b[0m\n",
" bus: 2\n",
" gen: 1\n",
"\n",
"\n",
"\u001b[1mTable: bus\u001b[0m\n",
" vm, va\n",
" 1: 1.020, 0.000\n",
" 2: 1.000, -0.128\n",
"\n",
"\n",
"\u001b[1mTable: gen\u001b[0m\n",
" pg, qg\n",
" 1: 0.703, 0.051\n"
]
}
],
"source": [
"data = PowerModels.parse_file(\"C:/Users/Ewa/Downloads/Twogen2bus.m\")\n",
"pf_result = run_ac_pf(data ,Ipopt.Optimizer)\n",
"#PowerModels.print_summary(pf_result[\"solution\"])"
"data = PowerModels.parse_file(file_dir)\n",
"opt = optimizer_with_attributes(Ipopt.Optimizer, \"print_level\" => 0)\n",
"pf_result = run_ac_pf(data, opt)\n",
"PowerModels.print_summary(pf_result[\"solution\"])"
]
},
{
Expand Down Expand Up @@ -301,17 +420,17 @@
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.3.1",
"display_name": "Julia 1.4.0",
"language": "julia",
"name": "julia-1.3"
"name": "julia-1.4"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.3.1"
"version": "1.4.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
14 changes: 7 additions & 7 deletions docs/src/Examples/example_lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ x0_guess = [
0.0, #V1_I
-0.01, #V2_I
-0.01, #V3_I
0.0, #δω_vsm
0.2, #δθ_vsm
0.0, #ω_oc
0.2, #θ_oc
0.025, #qm
0.0015, #ξ_d
-0.07, #ξ_q
Expand All @@ -380,13 +380,13 @@ x0_guess = [
1.004, #vpll_d
0.0, #vpll_q
0.0, #ε_pll
0.1, #δθ_pll
0.1, #θ_pll
0.5, #id_cv
0.0, #iq_cv
0.95, #vod
-0.1, #voq
0.49, #iod
-0.1, #ioq
0.95, #Vd_filter
-0.1, #Vq_filter
0.49, #Id_filter
-0.1, #Iq_filter
1.0, #eq_p
0.47, #ed_p
0.6, #δ
Expand Down
10 changes: 6 additions & 4 deletions src/LITS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module LITS
####################################### Structs Exports ####################################

# Base Exports
export DynBranch
export DynamicLine
export Simulation
export run_simulation!
export ThreePhaseFault
Expand All @@ -23,10 +23,11 @@ import InfrastructureSystems
import DiffEqBase
import ForwardDiff
import SparseArrays: SparseMatrixCSC
import LinearAlgebra: BLAS
#import LinearAlgebra: BLAS
import LinearAlgebra: eigen
import Base.to_index
import NLsolve
import Base.ImmutableDict
import PowerSystems
const PSY = PowerSystems
const IS = InfrastructureSystems
Expand All @@ -41,7 +42,7 @@ include("base/simulation.jl")
#Common Models
include("models/branch.jl")
include("models/device.jl")
include("models/kcl.jl")
include("models/kirchoff_laws.jl")
include("models/dynline_model.jl")
include("models/ref_transformations.jl")

Expand All @@ -57,7 +58,7 @@ include("models/inverter_models/DCside_models.jl")
include("models/inverter_models/filter_models.jl")
include("models/inverter_models/frequency_estimator_models.jl")
include("models/inverter_models/outer_control_models.jl")
include("models/inverter_models/voltage_source_control_models.jl")
include("models/inverter_models/inner_control_models.jl")
include("models/inverter_models/converter_models.jl")

#Injection Models
Expand All @@ -69,6 +70,7 @@ include("models/system.jl")

#Utils
include("utils/plot_utils.jl")
include("utils/immutable_dicts.jl")
include("utils/print.jl")
include("utils/kwargs_check.jl")

Expand Down
31 changes: 17 additions & 14 deletions src/base/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,32 @@ Inverter Inner Vars:
md_var :: Modulation signal on the d-component
mq_var :: Modulation signal on the q-component
Vdc_var :: DC voltage supplied by the DC source
Vdo_var :: Voltage seen in the capacitor of the filter in the d-component
Vqo_var :: Voltage seen in the capacitor of the filter in the q-component
Vd_filter_var :: Voltage seen in the capacitor of the filter in the d-component
Vq_filter_var :: Voltage seen in the capacitor of the filter in the q-component
ω_freq_estimator_var :: Frequency estimated by the frequency estimator.
v_control_var :: Control voltage supplied from the outer loop control to the inner loop
ω_control_var :: Control frequency supplied from the outer loop control the inner loop
δdqRI_var :: Variation of the angle (PLL or VSM) of the inverter
V_oc_var :: Control voltage supplied from the outer loop control to the inner loop
ω_oc_var :: Control frequency supplied from the outer loop control the inner loop
θ_oc_var :: Variation of the angle (PLL or VSM) of the inverter
VR_inv_var :: Real terminal voltage on the inverter
VI_inv_var :: Imaginary terminal voltage on the inverter
Vdcnv_var :: Voltage supplied from the converter in the d-component
Vqcnv_var :: Voltage supplied from the converter in the q-component
Vd_cnv_var :: Voltage supplied from the converter in the d-component
Vq_cnv_var :: Voltage supplied from the converter in the q-component
"""

@enum inverter_inner_vars begin
md_var = 1
mq_var = 2
Vdc_var = 3
Vdo_var = 4
Vqo_var = 5
Vd_filter_var = 4
Vq_filter_var = 5
ω_freq_estimator_var = 6
v_control_var = 7
ω_control_var = 8
δdqRI_var = 9
V_oc_var = 7
ω_oc_var = 8
θ_oc_var = 9
VR_inv_var = 10
VI_inv_var = 11
Vdcnv_var = 12
Vqcnv_var = 13
Vd_cnv_var = 12
Vq_cnv_var = 13
end

Base.to_index(ix::inverter_inner_vars) = Int(ix)
Expand All @@ -84,5 +84,8 @@ const INNER_VARS = "inner_vars"
const YBUS = "Ybus"
const CONTROL_REFS = "control_refs"
const GLOBAL_VARS = "global_vars"
const VOLTAGE_BUSES_NO = "voltage_buses_no"
const CURRENT_BUSES_NO = "current_buses_no"
const TOTAL_SHUNTS = "total_shunts"

const SIMULATION_ACCEPTED_KWARGS = [:initial_guess, :initialize_simulation]
Loading