PowerModels.jl icon indicating copy to clipboard operation
PowerModels.jl copied to clipboard

Fix PSSE raw import for gen_status at load buses

Open KSepetanc opened this issue 1 year ago • 12 comments

Fixes #932 .

PSSE ignores generators at load buses (bus type 1). It does not use this flag to determine if the generator is PV or PQ which is different from Matpower. Instead, it uses Machine Control Mode parameter found in panel Machine Data Record -> Wind Data -> Control Mode or in the Machine sheet.

As such fix needs to be implemented only for PSSE and there are no changes for Matpower. Thus, the only change is in src\io\psse.jl.

Consider adding Memento warning before merging.

KSepetanc avatar Nov 01 '24 16:11 KSepetanc

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 93.93%. Comparing base (a89fd1b) to head (fb3ce28).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #934   +/-   ##
=======================================
  Coverage   93.93%   93.93%           
=======================================
  Files          43       43           
  Lines        9655     9658    +3     
=======================================
+ Hits         9069     9072    +3     
  Misses        586      586           
Files with missing lines Coverage Δ
src/io/psse.jl 96.34% <100.00%> (+0.02%) :arrow_up:

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a89fd1b...fb3ce28. Read the comment docs.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Nov 01 '24 16:11 codecov[bot]

@ccoffrin can you review this please?

KSepetanc avatar Nov 08 '24 08:11 KSepetanc

Sorry for the delay @KSepetanc. I have no way of verifying these semantics of PSSE. @jd-lara or @frederikgeth are you able to verify this behavior?

@KSepetanc, before merging we will need to add a test for this behavior so that we don't have a future regression.

ccoffrin avatar Nov 13 '24 17:11 ccoffrin

not able to verify, sorry, but can confirm he actual status of a machine is determined both by its status flag and the bus type code.

frederikgeth avatar Nov 15 '24 00:11 frederikgeth

@ccoffrin I can not find any network in the PowerModels test/data/pti that has generator placed at load bus. I am not very comfortable modifying those frankenstein networks (presumably frankenstein_70.raw) as I do not know repercussions on other tests. I will need help with this.

test construct should be something like this (in test/psse.jl after transformer status tests):

    @testset "generator status" begin
        data_pti = PowerModels.parse_file("../test/data/pti/frankenstein_70.raw")

        gen_off = Set(["8", "9"]) # put names of inactive gens here
        for (i,gen) in data_pti["gen"]
            if i in gen_off
                @test gen["gen_status"] == 0
            else
                @test gen["gen_status"] == 1
            end
        end
    end

KSepetanc avatar Nov 15 '24 11:11 KSepetanc

I have modified frankenstein_70.raw at but 1005 to load bus. Test has been added.

Do you think we need to add memento log in src/io/psse.jl line 214 for the case when bus type is 1 and gen["STAT"] is 1?

KSepetanc avatar Nov 15 '24 11:11 KSepetanc

@ccoffrin do you have someone else who can check this? I would like to close this issue soon.

KSepetanc avatar Nov 26 '24 09:11 KSepetanc

There is free trial version of PSSE with full computation support for up-to 50 buses. Can that help with the review?

KSepetanc avatar Nov 29 '24 12:11 KSepetanc

PSSE ignores generators at load buses (bus type 1)

Is there any documentation that we can link to that confirms this is the expected behavior? Otherwise, @KSepetanc could you construct an example in PSSE that confirms the problem? (e.g., with screenshots?)

odow avatar Dec 18 '24 19:12 odow

Image below shows no power going out of generator 1 at the shown bus. Bus type is seen in the text on the left (type 1 which is load bus). Generator is active and set to produce 10 MW and 10 Mvar (but does not inject anything). Turning generator on or off has no effect on power flows. Generators at generator buses that have injections are shown in similar way as loads on the upper part of the image (loads at load buses are not ignored). I used psse 35.1. I also have v34 and the result is the same. I will accept proposed revision.

image

Below is example where bus type is changed to type 2. Generator is now used by PSSE.

image

KSepetanc avatar Dec 18 '24 21:12 KSepetanc

Thanks. I don't have the domain expertise to know if this is correct, but it should help @ccoffrin review without needing to do work on his side.

odow avatar Dec 18 '24 22:12 odow

@ccoffrin, just a reminder, what is your feedback on this? Do you have additional requirements?

KSepetanc avatar Mar 02 '25 18:03 KSepetanc