From 4f50bbb9f8faeda4121e6147dfc4b3bc0e023601 Mon Sep 17 00:00:00 2001 From: pesap Date: Fri, 23 Aug 2024 12:23:39 -0600 Subject: [PATCH] Added Example for plexos --- src/r2x/parser/plexos.py | 2 + tests/data/2-bus_example.xml | 259 +++++++++++++++++++++++++++++++++++ tests/test_plexos_parser.py | 4 +- 3 files changed, 264 insertions(+), 1 deletion(-) create mode 100755 tests/data/2-bus_example.xml diff --git a/src/r2x/parser/plexos.py b/src/r2x/parser/plexos.py index 18d9085..c1d9b8b 100644 --- a/src/r2x/parser/plexos.py +++ b/src/r2x/parser/plexos.py @@ -823,6 +823,8 @@ def _construct_interfaces(self, default_model=TransmissionInterface): return def _select_model_name(self): + # TODO(pesap): Add fail mechanism + # https://github.com/NREL/R2X/issues/10 query = f""" select obj.name from t_object as obj diff --git a/tests/data/2-bus_example.xml b/tests/data/2-bus_example.xml new file mode 100755 index 0000000..c5501b1 --- /dev/null +++ b/tests/data/2-bus_example.xml @@ -0,0 +1,259 @@ + + + 1 + 1 + 0 + - + + + 2 + 2 + 0 + - + + + + 1 + System + 1 + true + 1 + The integrated energy system + + + 2 + Generator + 2 + true + 22 + Generating unit, or collection of like generating units + + + 4 + Fuel + 2 + true + 18 + Fuel for a thermal generating unit + + + 1 + 43 + 47 + 100 + 169864276 + + + 2 + 47 + 46 + 1 + 169864277 + + + 3 + 47 + 47 + 100 + 169864278 + + + 4 + 47 + 47 + 120 + 169864279 + + + 78 + Scenario + 11 + true + 35 + Data scenario + + + 43 + 1 + 1 + 1 + 2 + 20 + + + 44 + 1 + 1 + 261 + 22 + 21 + + + 45 + 1 + 1 + 261 + 22 + 22 + + + 46 + 1 + 1 + 196 + 19 + 23 + + + 47 + 1 + 1 + 1 + 2 + 24 + + + 52 + 2 + 20 + 12 + 22 + 21 + + + 53 + 1 + 1 + 39 + 4 + 25 + + + 54 + 2 + 24 + 7 + 4 + 25 + + + 55 + 2 + 24 + 12 + 22 + 22 + + + 56 + 22 + 21 + 264 + 19 + 23 + + + 57 + 22 + 22 + 264 + 19 + 23 + + + 58 + 1 + 1 + 707 + 80 + 26 + + + 59 + 1 + 1 + 700 + 78 + 27 + + + 60 + 80 + 26 + 708 + 78 + 27 + + + 1 + 1 + System + 1 + the system object + 98bd24fd-e92b-4738-92d4-3f03a8a09cc3 + + + 20 + 2 + SolarPV_01 + 2 + + 0b6116f3-28c3-4cb1-a3c9-bad59585db4e + + + 21 + 22 + node_01 + 22 + + b4652dbe-a597-44e5-a36e-b1c9d53e0b18 + + + 22 + 22 + node_02 + 22 + + f926e130-4719-4249-bf32-f0dded4a93bd + + + 23 + 19 + region_1 + 19 + + 5db56664-18a1-4e9e-a9f2-31fc816d8dda + + + 24 + 2 + ThermalCC_01 + 2 + + 6659cbb9-2851-483c-a5bc-1d03659f2ca2 + + + 25 + 4 + gas + 4 + + 71917e41-f45b-44ad-81db-d88efcc34aea + + + 26 + 80 + main_model + 80 + + baec2eea-16a4-4f3a-bd6f-c24664b0069e + + + 27 + 78 + MoreCapacity + 78 + + 331cc8ab-bff8-4416-91d2-748012abef75 + + diff --git a/tests/test_plexos_parser.py b/tests/test_plexos_parser.py index fd01680..b1aa7ae 100644 --- a/tests/test_plexos_parser.py +++ b/tests/test_plexos_parser.py @@ -4,7 +4,8 @@ from r2x.parser.handler import get_parser_data from r2x.parser.plexos import PlexosParser -DB_NAME = "plexos_example.xml" +DB_NAME = "2-bus_example.xml" +MODEL_NAME = "main_model" @pytest.fixture @@ -14,6 +15,7 @@ def plexos_scenario(tmp_path, data_folder): input_model="plexos", run_folder=data_folder, output_folder=tmp_path, + model=MODEL_NAME, solve_year=2035, weather_year=2012, fmap={"xml_file": {"fname": DB_NAME, "model": "default"}},