Skip to content

How to use current_constraint_limits and define c_rating_a? Testing and Documentation enhancement? #727

@friederikemeier

Description

@friederikemeier

Hi,

I am relatively new to PowerModels and am a former Matpower/Pandapower/Pypower user.
I am struggling with the definitions of current_contraint_limits.
I found the test for this in test/opf.jl in Lines 47ff and extended it a little bit to understand, what's happening.
In the test case "case_5clm.m", the c_rating_a for e.g. branch 7 is limited at 240 (and then 2.4 in the PowerModels branch Dict).
What unit is this? Is this in MVA at 1 p.u. as in Matpower?
This would equal a current of 0.602452 kA.

Below you can see, how I calculated the resulting current on this branch. It results in 0.7206 kA. It is dar too high...

What I also found out, is that the apparent power at the to bus of this branch equals 2.64 and before I got the warning

this code only supports positive rate_a values, changing the value on branch 7 to 264.0

... But why do I get this 264.0 here in the warning?
Obviously, the optimzation considers only this constraint for this branch and not the more restricitve current constraint...
The warning comes from the call of calc_thermal_limits!.
I get that it was constrained to the max. current at the max. voltage.
But because the voltage in the results is quite low, the current is getting too high at this power value.
Also, the resulting current nearly stays the same, regardless of the call of calc_thermal_limits!.

data = PowerModels.parse_file("case5_clm.m")
# in MPC: limit for branch 1: 240
for n in range(1,stop=7)
		n = string(n)
		data["branch"][n]["c_rating_a"] *= 1 
end

ipopt_solver = JuMP.optimizer_with_attributes(Ipopt.Optimizer,
										"print_level" => 0,
										"max_cpu_time" => 1e3,
										"tol" => 1e-8)

calc_thermal_limits!(data)
result = run_ac_opf(data, ipopt_solver)
println(result["termination_status"] == LOCALLY_SOLVED)
println(isapprox(result["objective"], 16513.6; atol = 1e0))

for n in range(1,stop=7)

		n = string(n)
		println("initial c_rating_a: " , data["branch"][n]["c_rating_a"])
		i_max = data["branch"][n]["c_rating_a"]/230/sqrt(3)*100 # 4.0
		println("according current in kA: ", i_max)
		sf = sqrt(result["solution"]["branch"][n]["qf"]^2+
						result["solution"]["branch"][n]["pf"]^2)
		st = sqrt(result["solution"]["branch"][n]["qt"]^2+
						result["solution"]["branch"][n]["pt"]^2)

		# voltage at from bus and to bus
		fb=data["branch"][n]["f_bus"]
		tb=data["branch"][n]["t_bus"]
		vm_f = result["solution"]["bus"][string(fb)]["vm"]
		vm_t = result["solution"]["bus"][string(tb)]["vm"]

		i_f = sf / vm_f / sqrt(3) / 230 * 100 
		i_t = st / vm_t / sqrt(3) / 230 * 100 
		println("resulting current:  ", i_t)

		f_loading = i_f/i_max
		t_loading = i_t/i_max
		println("resulting loading:  ", t_loading)
		println("reulting apparent power", st)
end

How should the c_rating_a be defined?
What kind of test could I add for this?
How can I get the Optimization to respect the current constraint?

I appreciate any kind of help on this and am ready to contribute if needed :)

Kind regards,

Friederike

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions