Skip to content

gridcal2rec.py - with GridCode >4. e.g. 5.1.8  #2

@jodoka23

Description

@jodoka23

Hi Guy's
Thank you for your great work! I work a lot in modeling, validation mainly with commercial tools like PowerFactory.
As a hobbyist, I was always looking for open source alternatives.
This is my first GIT feedback. If I made something wrong please let me know :)

I found some Issues regarding pf2rec/gridcal2rec.py together with the newest GridCal Version 5.1.8.

#1 Transformer Type Line 187

         if str(branch.branch_type) == 'transformer':

should be

        if str(branch.type_name) == 'transformer':

#2 add values to buses
change:

    if re.search(r"3.\d.\d", __VERSION) or __VERSION == '4.0.0':
        pf_S_bus_results["P [MW]"] = np.real(pf.results.Sbus * grid.Sbase)
        # Adding reactive power to the buses
        pf_S_bus_results["Q [MVAR]"] = np.imag(pf.results.Sbus * grid.Sbase)
    elif re.search(r"4.\d(.\d)*", __VERSION):
        # For version 4 of GridCal, power is already given in MW and MVar
        pf_S_bus_results["P [MW]"] = np.real(pf.results.Sbus)
        pf_S_bus_results["Q [MVAR]"] = np.imag(pf.results.Sbus)

to

  # For version >4 of GridCal, power is already given in MW and MVar
  pf_S_bus_results["P [MW]"] = np.real(pf.results.Sbus)
  pf_S_bus_results["Q [MVAR]"] = np.imag(pf.results.Sbus)

#3 bus names line 453

df_bus = pd.DataFrame(index = grid.bus_names, columns = headers)

should be

  df_bus = pd.DataFrame(index = grid.get_bus_names(), columns = headers)

There maybe also other problems. If I find more solutions I will let you know.

best Regards

Johannes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions