Skip to content

Commit

Permalink
Revert "area and zone into country and community"
Browse files Browse the repository at this point in the history
This reverts commit 6911fc6.
  • Loading branch information
Mate Zsebehazi committed Oct 4, 2024
1 parent 6b395f9 commit 5c99e02
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/GridCalEngine/IO/raw/raw_to_gridcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@


def get_gridcal_bus(psse_bus: RawBus,
area_dict: Dict[int, dev.Country],
zone_dict: Dict[int, dev.Community],
area_dict: Dict[int, dev.Area],
zone_dict: Dict[int, dev.Zone],
logger: Logger) -> Tuple[dev.Bus, Union[dev.Shunt, None]]:
"""
Expand All @@ -60,8 +60,8 @@ def get_gridcal_bus(psse_bus: RawBus,
bus = dev.Bus(name=name,
Vnom=psse_bus.BASKV, code=str(psse_bus.I), vmin=psse_bus.EVLO, vmax=psse_bus.EVHI, xpos=0, ypos=0,
active=True,
country=area_dict[psse_bus.AREA],
# zone=zone_dict[psse_bus.ZONE],
area=area_dict[psse_bus.AREA],
zone=zone_dict[psse_bus.ZONE],
Vm0=psse_bus.VM,
Va0=np.deg2rad(psse_bus.VA))

Expand All @@ -72,8 +72,8 @@ def get_gridcal_bus(psse_bus: RawBus,
xpos=0,
ypos=0,
active=True,
country=area_dict[psse_bus.AREA],
# zone=zone_dict[psse_bus.ZONE],
area=area_dict[psse_bus.AREA],
zone=zone_dict[psse_bus.ZONE],
Vm0=psse_bus.VM,
Va0=np.deg2rad(psse_bus.VA))

Expand All @@ -82,8 +82,8 @@ def get_gridcal_bus(psse_bus: RawBus,
name = psse_bus.NAME
bus = dev.Bus(name=name, code=str(psse_bus.I), Vnom=psse_bus.BASKV, vmin=0.9, vmax=1.1, xpos=0, ypos=0,
active=True,
country=area_dict[psse_bus.AREA],
# zone=zone_dict[psse_bus.ZONE],
area=area_dict[psse_bus.AREA],
zone=zone_dict[psse_bus.ZONE],
Vm0=psse_bus.VM,
Va0=np.deg2rad(psse_bus.VA))

Expand All @@ -99,8 +99,8 @@ def get_gridcal_bus(psse_bus: RawBus,
bus = dev.Bus(name=name,
Vnom=psse_bus.BASKV, code=str(psse_bus.I), vmin=psse_bus.EVLO, vmax=psse_bus.EVHI, xpos=0, ypos=0,
active=True,
country=area_dict[psse_bus.AREA],
# zone=zone_dict[psse_bus.ZONE],
area=area_dict[psse_bus.AREA],
zone=zone_dict[psse_bus.ZONE],
Vm0=psse_bus.VM,
Va0=np.deg2rad(psse_bus.VA))

Expand Down Expand Up @@ -767,11 +767,11 @@ def psse_to_gridcal(psse_circuit: PsseCircuit,
circuit = MultiCircuit(Sbase=psse_circuit.SBASE)
circuit.comments = 'Converted from a PSS/e .raw file'

circuit.countries = [dev.Country(name=x.ARNAME) for x in psse_circuit.areas]
circuit.communities = [dev.Community(name=x.ZONAME) for x in psse_circuit.zones]
circuit.areas = [dev.Area(name=x.ARNAME) for x in psse_circuit.areas]
circuit.zones = [dev.Zone(name=x.ZONAME) for x in psse_circuit.zones]

area_dict = {val.I: elm for val, elm in zip(psse_circuit.areas, circuit.countries)}
zones_dict = {val.I: elm for val, elm in zip(psse_circuit.zones, circuit.communities)}
area_dict = {val.I: elm for val, elm in zip(psse_circuit.areas, circuit.areas)}
zones_dict = {val.I: elm for val, elm in zip(psse_circuit.zones, circuit.zones)}

# scan for missing zones or areas (yes, PSSe is so crappy that can reference areas that do not exist)
missing_areas = False
Expand Down Expand Up @@ -807,10 +807,10 @@ def psse_to_gridcal(psse_circuit: PsseCircuit,
circuit.add_shunt(bus=bus, api_obj=bus_shunt)

if missing_areas:
circuit.countries = [v for k, v in area_dict.items()]
circuit.areas = [v for k, v in area_dict.items()]

if missing_zones:
circuit.communities = [v for k, v in zones_dict.items()]
circuit.zones = [v for k, v in zones_dict.items()]

# check htat the area slack buses actually make sense
for area in psse_circuit.areas:
Expand Down

0 comments on commit 5c99e02

Please sign in to comment.