lanl-ansi / PowerModels.jl

A Julia/JuMP Package for Power Network Optimization
https://lanl-ansi.github.io/PowerModels.jl/stable/
Other
384 stars 145 forks source link

pf and pt dcline active power with same sign in psse parser #794

Open iagochavarry opened 2 years ago

iagochavarry commented 2 years ago

Shouldn't the active power in each of the dcline terminations have opposite signs (one end is absorbing - positive sign - and the other is injecting - negative sign)?

I think in matpower convention pt is negative and pf is positive.

In psse parser, power_demand have the same sign.

        power_demand = dcline["MDC"] == 1 ? abs(dcline["SETVL"]) : dcline["MDC"] == 2 ? abs(dcline["SETVL"] / pop!(dcline, "VSCHD") / 1000) : 0
        ...
        sub_data["pf"] = power_demand
        sub_data["pt"] = power_demand

In matpower parser, the pt is set to be negative

        dcline["pt"] = -dcline["pt"] 
ccoffrin commented 2 years ago

In PowerModels pf and pt should be what the measured values on the from and to sides of any line (AC or DC). Adding them together should yield the value of the line losses.

I presume this was checked when we built the Matpower parser (and the associated negative sign). However, if you find there is an inconsistency in that interpretation, please let me know.

I'll ask @jbarberia regarding what is the convention for this in of PSSE.

iagochavarry commented 2 years ago

I presume this was checked when we built the Matpower parser (and the associated negative sign). However, if you find there is an inconsistency in that interpretation, please let me know.

In Matpower parser this seems to be correct!

I'll ask @jbarberia regarding what is the convention for this in of PSSE.

Additionaly, if we look at the hvdc psse parsing test, the limits for pt are negative, and the variable itself is positive (inconsistency).

julia> data = PowerModels.parse_file("../test/data/pti/two-terminal-hvdc_test.raw")
julia> data["dcline"]["1"]
Dict{String, Any} with 26 entries:
  "pmaxt"     => 0.0
  "pmint"     => -0.2
  "pt"        => 0.2
  "pmaxf"     => 0.2
  "pminf"     => 0.0
  "pf"        => 0.2

I believe that the PSSE parser don't have the loss factor information (loss = 0). Therefore, the equivalence should be something like:

 pf + pt = loss = 0 => pf = - pt
frederikgeth commented 2 years ago

In the math model, powermodels sticks with the convention pf+ pt = ploss >=0 (if r>=0). Matpower, however in its data model, defines pf-pt=ploss. I think this is mainly because they're re-using the generator model to implement dc lines instead of the ac line model. This does indeed lead to the optimized variables pf and pt having the same sign in the solution. The minus in the parser comes from this change of convention. I don't know what the PSS/E convention is.

ccoffrin commented 2 years ago

@jbarberia you do know the PSSE convention on this point?

jbarberia commented 2 years ago

@ccoffrin sorry for the delay in replying.

In PSSE, the desired power value is set in the rectifier (SETVL> 0) or in the inverter (SETVL <0). In both cases the power-flow goes from the rectifier to the inverter. The losses can be calculated with the dc-line voltage (VSCHD) and the dc-line resistance (RDC)

Example:

SETVL = -100 [MW]
RDC = 6.2 [Ohm]
VSC = 640 [kV]

current = SETVL / VSC = 217.4 [A] 
loss = current^2 * RDC = 0.29 [MW]

pt = 100 [MW] #rectifier-side
pf = 100.29 [MW] #inverter-side

For a better conversion of the model from PSSE to PM it would be better to take into account the losses.

ccoffrin commented 2 years ago

@jbarberia thanks for this. Based on what you say here at least it sounds like we should account for a sign change in the pt and pf values when reading/writing data files or omit these values. Do you have a preference one way or another?

jbarberia commented 2 years ago

I agree with the sign change. We could also add the losses on one side or the other depending on the sign of SETVL.