PowerFlows.jl
PowerFlows.jl copied to clipboard
How to update the PowerFlowData for multiple periods after solving an UC problem
As indicated in the title, if an optimization problem is solved, how can I update the PowerFlowData, i.e. updating the PowerFlowData().bus_activepower_injection and PowerFlowData().bus_activepower_withdrawals based on the optimisation results?
It looks like both PowerFlowData().bus_activepower_injection and PowerFlowData().bus_activepower_withdrawals are not mutable.
Hi @eeliubin ,
It should be possible to change the values of bus_activepower_injection and bus_activepower_withdrawals, as long as you change the values in the arrays (as opposed to reassigning the attributes of PowerFlowData), e.g. bus_activepower_withdrawals .= new_values.
Alternatively, if you execute the UC with PowerSimulations, you can specify that the power flow calculation is executed after a successful optimization:
https://github.com/NREL-Sienna/PowerSimulations.jl/blob/ba846178b5c4dc377f9bbc655bc725ee30f06db3/test/test_simulation_results.jl#L1035
Thank you, @rbolgaryn & The approach you mentioned for setting bus_activepower_injection and bus_activepower_withdrawals works.
For the other approach, I wonder if there are any documents discussing how to define the keyword: power_flow_evaluation. Also, does the power flow evaluation perform the same process as if I run solve_powerflow(ACPowerFlow(), sys)? I noticed that that latter does not support PhaseShiftingTX for ACPowerFlow().
You are welcome!
The PowerFlows project is presently in active development, and we haven't yet gotten to writing a proper documentation.
The latter power flow calculation is applied directly to the PowerFlowData instance, and consequently the results are not written back to data. Rather, they are included in the auxiliary variables after the optimization step. In other words, it uses the function solve_powerflow!(data::PowerFlowData; pf::ACPowerFlow).
I am not sure about the phase shifter, I will need to check it. If you already have an example with the phase shifter, could you provide it for testing?
I tested the 5-bus system in pss/e format under "....\PowerSystemsTestData\psse_raw\case5.raw" with the following codes:
sys_path = joinpath([to define], "psse_raw", "case5.raw")
sys = System(sys_path; runchecks=false, frequency=50
pf_res = solve_powerflow(ACPowerFlow(), sys)
The error showed that ERROR: Systems with PhaseShiftingTransformer not supported yet.
I tested the 5-bus system in pss/e format under "....\PowerSystemsTestData\psse_raw\case5.raw" with the following codes:
sys_path = joinpath([to define], "psse_raw", "case5.raw")sys = System(sys_path; runchecks=false, frequency=50pf_res = solve_powerflow(ACPowerFlow(), sys)The error showed that
ERROR: Systems with PhaseShiftingTransformer not supported yet.
Can you please test it in the following way:
data = PowerFlowData(ACPowerFlow(), sys)
solve_powerflow!(data)
The results are written to the following fields:
bus_activepower_injection::Matrix{Float64}
bus_reactivepower_injection::Matrix{Float64}
bus_activepower_withdrawals::Matrix{Float64}
bus_reactivepower_withdrawals::Matrix{Float64}
branch_activepower_flow_from_to::Matrix{Float64}
branch_reactivepower_flow_from_to::Matrix{Float64}
branch_activepower_flow_to_from::Matrix{Float64}
branch_reactivepower_flow_to_from::Matrix{Float64}
I am going to close this in favor of a more detailed one