-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multiple sources at one bus and no other devices (#11)
* multiple sources at one bus and no other devices * add test for only sources
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
@testset "Powerflow with multiple sources at bus" begin | ||
sys = System(100.0) | ||
b = Bus( | ||
number=1, | ||
name="01", | ||
bustype=BusTypes.REF, | ||
angle=0.0, | ||
magnitude=1.1, | ||
voltage_limits=(0.0, 2.0), | ||
base_voltage=230, | ||
) | ||
add_component!(sys, b) | ||
|
||
#Test two sources with equal and opposite P and Q | ||
s1 = Source( | ||
name="source_1", | ||
available=true, | ||
bus=b, | ||
active_power=0.5, | ||
reactive_power=0.1, | ||
R_th=1e-5, | ||
X_th=1e-5, | ||
) | ||
add_component!(sys, s1) | ||
s2 = Source( | ||
name="source_2", | ||
available=true, | ||
bus=b, | ||
active_power=-0.5, | ||
reactive_power=-0.1, | ||
R_th=1e-5, | ||
X_th=1e-5, | ||
) | ||
add_component!(sys, s2) | ||
@test run_powerflow!(sys, finite_diff=true) | ||
|
||
#Create power mismatch, test for error | ||
set_active_power!(get_component(Source, sys, "source_1"), -0.4) | ||
@test_throws ErrorException( | ||
"Sources do not match P and/or Q requirements for reference bus.", | ||
) run_powerflow!(sys, finite_diff=true) | ||
end |