diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml new file mode 100644 index 00000000..481933b3 --- /dev/null +++ b/.github/workflows/python-tests-consolidated.yaml @@ -0,0 +1,205 @@ +name: CI/CD test suite + +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' + +jobs: + + setup-install: + name: Setup and install Ard + strategy: + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + path: ~/.cache/pip + - os: macos-latest + path: ~/Library/Caches/pip + - os: windows-latest + path: ~\AppData\Local\pip\Cache + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Cache dependencies + id: cache + uses: actions/cache@v4 + with: + path: ${{ matrix.path }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: + ${{ runner.os }}-pip- + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Install Ard + run: | + pip install .[dev] + + test-unit: + name: Run unit tests + needs: setup-install + strategy: + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + path: ~/.cache/pip + - os: macos-latest + path: ~/Library/Caches/pip + - os: windows-latest + path: ~\AppData\Local\pip\Cache + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Get cache dependencies + id: cache + uses: actions/cache@v4 + with: + path: ${{ matrix.path }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: + ${{ runner.os }}-pip- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Install Ard + run: | + pip install .[dev] + - name: Run unit tests with coverage + run: | + pytest --cov=ard --cov-fail-under=80 test/unit + + test-system: + name: Run system tests + needs: test-unit + strategy: + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + path: ~/.cache/pip + - os: macos-latest + path: ~/Library/Caches/pip + - os: windows-latest + path: ~\AppData\Local\pip\Cache + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Get cache dependencies + id: cache + uses: actions/cache@v4 + with: + path: ${{ matrix.path }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: + ${{ runner.os }}-pip- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Install Ard + run: | + pip install .[dev] + - name: Run system tests with coverage + run: | + pytest --cov=ard --cov-fail-under=50 test/system + # pytest --cov=ard --cov-fail-under=80 test/system + + find-examples: + name: Find all examples + needs: [test-unit, test-system] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Find example python scripts + id: find_scripts + run: | + echo "scripts<> $GITHUB_OUTPUT + find examples -mindepth 2 -maxdepth 2 -name "*.py" | jq -R -s -c 'split("\n")[:-1]' >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + outputs: + scripts: ${{ steps.find_scripts.outputs.scripts }} + + test-examples: + name: Run all examples + needs: find-examples + strategy: + fail-fast: false + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + path: ~/.cache/pip + - os: macos-latest + path: ~/Library/Caches/pip + - os: windows-latest + path: ~\AppData\Local\pip\Cache + script: ${{fromJson(needs.find-examples.outputs.scripts)}} + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Get cache dependencies + id: cache + uses: actions/cache@v4 + with: + path: ${{ matrix.path }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: + ${{ runner.os }}-pip- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Install Ard + run: | + pip install .[dev] + - name: Run examples + shell: python + run: | + import os + import pathlib + import subprocess + + env = os.environ.copy() + env["MPLBACKEND"] = "Agg" # Non-interactive backend + + path_script = pathlib.Path("${{ matrix.script }}").absolute() + print(f"RUNNING {path_script}") + subprocess.run( + ["python", str(path_script.name)], + check=True, + cwd=str(path_script.parent), + env=env, + ) diff --git a/.github/workflows/python-tests-system.yml b/.github/workflows/python-tests-system.yml deleted file mode 100644 index bddbae4f..00000000 --- a/.github/workflows/python-tests-system.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Python System Tests with Coverage - -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' - -jobs: - test: - strategy: - matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - - name: Install Ard - run: | - pip install .[dev] - - - name: Run system tests with coverage - run: | - pytest --cov=ard --cov-fail-under=50 test/system - # pytest --cov=ard --cov-fail-under=80 test/system - - # - name: Upload coverage report - # uses: codecov/codecov-action@v2 - # with: - # file: ./coverage.xml - # flags: unittests - # name: codecov-umbrella - diff --git a/.github/workflows/python-tests-unit.yml b/.github/workflows/python-tests-unit.yml deleted file mode 100644 index cd4f88e6..00000000 --- a/.github/workflows/python-tests-unit.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Python Unit Tests with Coverage - -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' - -jobs: - test: - strategy: - matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - - name: Install Ard - run: | - pip install .[dev] - - - name: Run unit tests with coverage - run: | - pytest --cov=ard --cov-fail-under=80 test/unit - - # - name: Upload coverage report - # uses: codecov/codecov-action@v2 - # with: - # file: ./coverage.xml - # flags: unittests - # name: codecov-umbrella diff --git a/ard/__init__.py b/ard/__init__.py index ab3d9d1c..0f68643f 100644 --- a/ard/__init__.py +++ b/ard/__init__.py @@ -6,5 +6,5 @@ from pathlib import Path -BASE_DIR = Path(__file__).resolve().parent +BASE_DIR = Path(__file__).absolute().parent ASSET_DIR = BASE_DIR / "api" / "default_systems" diff --git a/examples/01-iea-wind-740-10-rowp/inputs/ard/ard_driver.yaml b/examples/01-iea-wind-740-10-rowp/inputs/ard/ard_driver.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/01-iea-wind-740-10-rowp/inputs/ard/ard_system.yaml b/examples/01-iea-wind-740-10-rowp/inputs/ard/ard_system.yaml deleted file mode 100644 index 069da571..00000000 --- a/examples/01-iea-wind-740-10-rowp/inputs/ard/ard_system.yaml +++ /dev/null @@ -1,16 +0,0 @@ -groups: - aerodynamics: - promotes: ["*"] - systems: - aep: - type: group - promotes: ["*"] - systems: - floris: - name: farm_aero.floris - object: FLORISAEP - type: component - promotes: ["*"] - kwargs: - case_title: "test" - modeling_options: "example_value" \ No newline at end of file diff --git a/examples/01-iea-wind-740-10-rowp/inputs/ard/modeling_options.yaml b/examples/01-iea-wind-740-10-rowp/inputs/ard/modeling_options.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/01-iea-wind-740-10-rowp/inputs/data/IEA37_10MW_turbine.yaml b/examples/01-iea-wind-740-10-rowp/inputs/data/IEA37_10MW_turbine.yaml deleted file mode 100644 index d170e1e4..00000000 --- a/examples/01-iea-wind-740-10-rowp/inputs/data/IEA37_10MW_turbine.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: IEA Wind Task 37 10MW Offshore Reference Turbine -performance: - rated_power: 10000000 - cutin_wind_speed: 4.0 - cutout_wind_speed: 25.0 - power_curve: - power_values: [387510.9723, 644692.8925, 937974.799, 1257928.478, 1604119.995, 1969504.269, 2340111.432, 2708595.63, 3067098.715, 3408654.893, 3723706.607, 4003354.317, 4239645.746, 4425830.055, 4556570.854, 4628112.983, 4638399.089, 4690045.495, 4804899.691, 4985748.651, 5236938.939, 5564425.114, 5975831.243, 6480522.086, 7089679.768, 7816381.143, 8690612.607, 9716655.499, 10000000, 9999999.662, 10000000.11, 9999986.888, 10000034.43, 10000023.5, 10000017.75, 10000014.23, 10000011.69, 10000009.65, 10000007.96, 10000006.47, 10000005.1, 10000003.98, 10000003.09, 10000002.36, 10000001.76, 10000001.26, 10000000.85, 10000000.53, 10000000.28, 10000041.66] - power_wind_speeds: [4, 4.514652562, 5.000795688, 5.457350016, 5.883301884, 6.277705571, 6.639685402, 6.968437691, 7.263232527, 7.523415391, 7.748408611, 7.937712648, 8.090907197, 8.20765213, 8.287688244, 8.330837837, 8.337005108, 8.367833853, 8.435590166, 8.540123611, 8.681202099, 8.858512398, 9.071660837, 9.320174171, 9.603500641, 9.921011189, 10.27200086, 10.65569038, 10.75773635, 11.51769068, 11.9940876, 12.49936091, 13.03238875, 13.59198769, 14.17691527, 14.7858728, 15.41750825, 16.07041923, 16.74315611, 17.43422525, 18.1420923, 18.86518562, 19.60189976, 20.35059904, 21.10962115, 21.87728087, 22.65187381, 23.43168018, 24.21496861, 25] - Ct_curve: - Ct_values: [0.770113776, 0.776301765, 0.782430404, 0.781982993, 0.780246928, 0.777153006, 0.771853687, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.767521911, 0.765104347, 0.758675026, 0.505649564, 0.431035612, 0.370827539, 0.320855929, 0.278805531, 0.243151019, 0.212773558, 0.186803785, 0.164542221, 0.145414565, 0.128943645, 0.114730283, 0.102438991, 0.091786964, 0.082535328, 0.074482009, 0.067455867, 0.061311766, 0.05592648, 0.051195261, 0.047029125] - Ct_wind_speeds: [4, 4.514652562, 5.000795688, 5.457350016, 5.883301884, 6.277705571, 6.639685402, 6.968437691, 7.263232527, 7.523415391, 7.748408611, 7.937712648, 8.090907197, 8.20765213, 8.287688244, 8.330837837, 8.337005108, 8.367833853, 8.435590166, 8.540123611, 8.681202099, 8.858512398, 9.071660837, 9.320174171, 9.603500641, 9.921011189, 10.27200086, 10.65569038, 10.75773635, 11.51769068, 11.9940876, 12.49936091, 13.03238875, 13.59198769, 14.17691527, 14.7858728, 15.41750825, 16.07041923, 16.74315611, 17.43422525, 18.1420923, 18.86518562, 19.60189976, 20.35059904, 21.10962115, 21.87728087, 22.65187381, 23.43168018, 24.21496861, 25] -hub_height: 119.0 -rotor_diameter: 198.0 -tilt: 5.0 diff --git a/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular.yaml b/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular.yaml deleted file mode 100644 index a16fcaf3..00000000 --- a/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: IEA Wind 740-10-MW Reference Offshore Wind Plant with regular layout (plant) -layouts: - initial_layout: - coordinates: - x: [ - 500968.1461, 499748.6565, 501245.7744, 500026.2848, 498527.8286, - 497308.339, 501523.4027, 500303.9131, 498805.4569, 497585.9673, - 496087.5111, 494868.0215, 501801.031, 500581.5414, 499083.0852, - 497863.5956, 496365.1394, 495145.6498, 493647.1936, 492427.704, - 502078.6593, 500859.1697, 499360.7135, 498141.2239, 496642.7677, - 495423.2781, 493924.8219, 492705.3323, 491206.8762, 489987.3865, - 502356.2876, 501136.798, 499638.3418, 498418.8522, 496920.396, - 495700.9064, 494202.4502, 492982.9606, 491484.5045, 490265.0148, - 488766.5587, 487547.069, 502633.9159, 501414.4263, 499915.9701, - 498696.4805, 497198.0243, 495978.5347, 494480.0786, 493260.5889, - 491762.1328, 490542.6431, 489044.187, 487824.6973, 486326.2412, - 485106.7515, 497475.6526, 496256.163, 494757.7069, 493538.2172, - 492039.7611, 490820.2714, 489321.8153, 488102.3256, 486603.8695, - 497753.2809, 496533.7913, 495035.3352, 493815.8455, 492317.3894, - 489599.4436, 498030.9093, 496811.4196, 495312.9635 - ] - y: [ - 5716452.784, 5717635.848, 5718427.22, 5719610.283, 5718809.394, - 5719992.458, 5720401.656, 5721584.719, 5720783.83, 5721966.894, - 5721166.004, 5722349.068, 5722376.092, 5723559.155, 5722758.266, - 5723941.33, 5723140.44, 5724323.504, 5723522.615, 5724705.678, - 5724350.528, 5725533.591, 5724732.702, 5725915.765, 5725114.876, - 5726297.94, 5725497.051, 5726680.114, 5725879.225, 5727062.288, - 5726324.963, 5727508.027, 5726707.138, 5727890.201, 5727089.312, - 5728272.376, 5727471.486, 5728654.55, 5727853.661, 5729036.724, - 5728235.835, 5729418.899, 5728299.399, 5729482.463, 5728681.574, - 5729864.637, 5729063.748, 5730246.812, 5729445.922, 5730628.986, - 5729828.097, 5731011.16, 5730210.271, 5731393.335, 5730592.445, - 5731775.509, 5731038.184, 5732221.248, 5731420.358, 5732603.422, - 5731802.533, 5732985.596, 5732184.707, 5733367.77, 5732566.881, - 5733012.62, 5734195.683, 5733394.794, 5734577.858, 5733776.968, - 5734159.143, 5734987.056, 5736170.119, 5735369.23 - ] - -electrical_substations: - coordinates: - x: [497620.7] - y: [5730622.0] -electrical_collection_array: - edges: [[0, 2, 0], [1, 4, 0], [2, 6, 0], [3, 8, 0], [4, 5, 0], [5, 10, 0], [6, 7, 0], - [7, 14, 1], [8, 9, 0], [9, 15, 0], [10, 16, 1], [11, 18, 0], [12, 13, 0], - [13, 20, 0], [14, 22, 1], [15, 24, 1], [16, 17, 1], [17, 25, 2], [18, 19, 0], - [19, 26, 0], [20, 21, 0], [21, 32, 1], [21, 30, 0], [22, 23, 2], [23, -1, 2], - [24, 34, 1], [25, -1, 2], [26, 27, 1], [27, 36, 1], [28, 29, 0], [29, 38, 0], - [29, 40, 0], [31, 44, 0], [31, 42, 0], [32, 33, 2], [33, -1, 2], [34, 46, 2], - [35, -1, 2], [35, 36, 2], [37, 48, 1], [37, 38, 1], [39, 50, 1], [39, 52, 1], - [41, 52, 0], [41, 54, 0], [43, 44, 0], [44, 45, 1], [45, -1, 1], [46, -1, 2], - [47, -1, 2], [47, 48, 2], [49, -1, 2], [49, 50, 2], [51, 60, 1], [51, 62, 0], - [53, 62, 0], [53, 64, 0], [54, 55, 0], [56, -1, 2], [56, 65, 1], [57, -1, 2], - [57, 67, 2], [58, -1, 2], [58, 59, 2], [59, 60, 1], [61, 69, 0], [61, 70, 0], - [63, 70, 0], [65, 66, 1], [66, 71, 0], [66, 73, 0], [67, 68, 1], [68, 69, 1], - [71, 72, 0]] - cables: - cable_type: [0, 1, 2] - cross_section: [95, 240, 500] - current_capacity: [300, 480, 655] - turbines_supplied: [3, 5, 7] - -turbines: !include IEA37_10MW_turbine.yaml diff --git a/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular_System.yaml b/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular_System.yaml deleted file mode 100644 index b7660054..00000000 --- a/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular_System.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: IEA Wind 740-10-MW Reference Offshore Wind Plant with regular layout (system) -site: !include Site.yaml -wind_farm: !include ROWP_Regular.yaml -attributes: - net_AEP: 3385.51 - analyses: - wake_model: - name: Jensen - diff --git a/examples/01-iea-wind-740-10-rowp/run-iea-wind-740-10-rowp.py b/examples/01-iea-wind-740-10-rowp/run-iea-wind-740-10-rowp.py deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/02_onshore/inputs/ard_system.yaml b/examples/01_onshore/inputs/ard_system.yaml similarity index 89% rename from examples/02_onshore/inputs/ard_system.yaml rename to examples/01_onshore/inputs/ard_system.yaml index 90601197..238d4ac2 100644 --- a/examples/02_onshore/inputs/ard_system.yaml +++ b/examples/01_onshore/inputs/ard_system.yaml @@ -21,7 +21,11 @@ modeling_options: solver_name: "highs" solver_options: time_limit: 60 - mip_gap: 0.005 + mip_gap: 0.02 + model_options: + topology: "branched" + feeder_route: "segmented" + feeder_limit: "unlimited" offshore: false floating: false diff --git a/examples/02_onshore/inputs/power_thrust_table_ccblade_IEA-3p4-130-RWT.csv b/examples/01_onshore/inputs/power_thrust_table_ccblade_IEA-3p4-130-RWT.csv similarity index 100% rename from examples/02_onshore/inputs/power_thrust_table_ccblade_IEA-3p4-130-RWT.csv rename to examples/01_onshore/inputs/power_thrust_table_ccblade_IEA-3p4-130-RWT.csv diff --git a/examples/02_onshore/inputs/turbine_spec_IEA-3p4-130-RWT.yaml b/examples/01_onshore/inputs/turbine_spec_IEA-3p4-130-RWT.yaml similarity index 100% rename from examples/02_onshore/inputs/turbine_spec_IEA-3p4-130-RWT.yaml rename to examples/01_onshore/inputs/turbine_spec_IEA-3p4-130-RWT.yaml diff --git a/examples/02_onshore/inputs/wrg_example.wrg b/examples/01_onshore/inputs/wrg_example.wrg similarity index 100% rename from examples/02_onshore/inputs/wrg_example.wrg rename to examples/01_onshore/inputs/wrg_example.wrg diff --git a/examples/02_onshore/optimization_analysis.ipynb b/examples/01_onshore/optimization_analysis.ipynb similarity index 100% rename from examples/02_onshore/optimization_analysis.ipynb rename to examples/01_onshore/optimization_analysis.ipynb diff --git a/examples/02_onshore/optimization_demo.py b/examples/01_onshore/optimization_demo.py similarity index 63% rename from examples/02_onshore/optimization_demo.py rename to examples/01_onshore/optimization_demo.py index 3f020ae5..ab8eb598 100644 --- a/examples/02_onshore/optimization_demo.py +++ b/examples/01_onshore/optimization_demo.py @@ -28,7 +28,7 @@ def run_example(): test_data = { "AEP_val": float(prob.get_val("AEP_farm", units="GW*h")[0]), "CapEx_val": float(prob.get_val("tcc.tcc", units="MUSD")[0]), - "BOS_val": float(prob.get_val("landbosse.total_capex", units="MUSD")[0]), + "BOS_val": float(prob.get_val("total_capex", units="MUSD")[0]), "OpEx_val": float(prob.get_val("opex.opex", units="MUSD/yr")[0]), "LCOE_val": float(prob.get_val("financese.lcoe", units="USD/MW/h")[0]), "area_tight": float(prob.get_val("landuse.area_tight", units="km**2")[0]), @@ -56,7 +56,7 @@ def run_example(): test_data = { "AEP_val": float(prob.get_val("AEP_farm", units="GW*h")[0]), "CapEx_val": float(prob.get_val("tcc.tcc", units="MUSD")[0]), - "BOS_val": float(prob.get_val("landbosse.total_capex", units="MUSD")[0]), + "BOS_val": float(prob.get_val("total_capex", units="MUSD")[0]), "OpEx_val": float(prob.get_val("opex.opex", units="MUSD/yr")[0]), "LCOE_val": float(prob.get_val("financese.lcoe", units="USD/MW/h")[0]), "area_tight": float(prob.get_val("landuse.area_tight", units="km**2")[0]), @@ -77,43 +77,6 @@ def run_example(): print("\n\n") -# # plot convergence -# ## read cases -# cr = om.CaseReader( -# prob.get_outputs_dir() -# / input_dict["analysis_options"]["recorder"]["filepath"] -# ) -# -# # Extract the driver cases -# cases = cr.get_cases("driver") -# -# # Initialize lists to store iteration data -# iterations = [] -# objective_values = [] -# -# # Loop through the cases and extract iteration number and objective value -# for i, case in enumerate(cases): -# iterations.append(i) -# objective_values.append( -# case.get_objectives()[ -# input_dict["analysis_options"]["objective"]["name"] -# ] -# ) -# -# # Plot the convergence -# plt.figure(figsize=(8, 6)) -# plt.plot(iterations, objective_values, marker="o", label="Objective (LCOE)") -# plt.xlabel("Iteration") -# plt.ylabel("Objective Value (Total Cable Length (m))") -# plt.title("Convergence Plot") -# plt.legend() -# plt.grid() -# plt.show() -# -# optiwindnet.plotting.gplot(prob.model.optiwindnet_coll.graph) -# -# plt.show() - if __name__ == "__main__": run_example() diff --git a/examples/03_offshore_fixed/inputs/ard_system.yaml b/examples/02_offshore_fixed/inputs/ard_system.yaml similarity index 90% rename from examples/03_offshore_fixed/inputs/ard_system.yaml rename to examples/02_offshore_fixed/inputs/ard_system.yaml index 055c61ed..0a76338e 100644 --- a/examples/03_offshore_fixed/inputs/ard_system.yaml +++ b/examples/02_offshore_fixed/inputs/ard_system.yaml @@ -49,7 +49,11 @@ modeling_options: &modeling_options solver_name: "highs" solver_options: time_limit: 60 - mip_gap: 0.005 + mip_gap: 0.02 + model_options: + topology: "branched" + feeder_route: "segmented" + feeder_limit: "unlimited" offshore: true floating: false site_depth: 50.0 diff --git a/examples/03_offshore_fixed/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv b/examples/02_offshore_fixed/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv similarity index 100% rename from examples/03_offshore_fixed/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv rename to examples/02_offshore_fixed/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv diff --git a/examples/03_offshore_fixed/inputs/turbine_spec_IEA-22-284-RWT.yaml b/examples/02_offshore_fixed/inputs/turbine_spec_IEA-22-284-RWT.yaml similarity index 100% rename from examples/03_offshore_fixed/inputs/turbine_spec_IEA-22-284-RWT.yaml rename to examples/02_offshore_fixed/inputs/turbine_spec_IEA-22-284-RWT.yaml diff --git a/examples/03_offshore_fixed/inputs/wrg_example.wrg b/examples/02_offshore_fixed/inputs/wrg_example.wrg similarity index 100% rename from examples/03_offshore_fixed/inputs/wrg_example.wrg rename to examples/02_offshore_fixed/inputs/wrg_example.wrg diff --git a/examples/03_offshore_fixed/optimization_demo.py b/examples/02_offshore_fixed/optimization_demo.py similarity index 67% rename from examples/03_offshore_fixed/optimization_demo.py rename to examples/02_offshore_fixed/optimization_demo.py index a8cf32d7..179fa93d 100644 --- a/examples/03_offshore_fixed/optimization_demo.py +++ b/examples/02_offshore_fixed/optimization_demo.py @@ -20,8 +20,9 @@ def run_example(): # run the model prob.run_model() - # Visualize model - om.n2(prob) + if False: + # visualize model + om.n2(prob) # collapse the test result data test_data = { @@ -116,61 +117,3 @@ def run_example(): if __name__ == "__main__": run_example() - -# RESULTS: - - -# {'AEP_val': 4818.0, -# 'BOS_val': 2127.5924853696597, -# 'CapEx_val': 768.4437570425, -# 'LCOE_val': 57.63858824842508, -# 'OpEx_val': 60.50000000000001, -# 'area_tight': 63.234304, -# 'coll_length': 47.761107521256534, -# 'mooring_spacing': 1.1208759839268934} - - -# /opt/anaconda3/envs/ard/lib/python3.12/site-packages/openmdao/recorders/sqlite_recorder.py:231: UserWarning:The existing case recorder file, /Users/jthomas2/Documents/programs/Ard/examples/offshore/optimization_demo_out/opt_results.sql, is being overwritten. -# Optimization terminated successfully (Exit mode 0) -# Current function value: 20495.94468696311 -# Iterations: 13 -# Function evaluations: 9 -# Gradient evaluations: 9 -# Optimization Complete -# ----------------------------------- - - -# RESULTS (opt): - -# {'AEP_val': 4818.0, -# 'BOS_val': 2113.9686662769814, -# 'CapEx_val': 768.4437570425, -# 'LCOE_val': 57.42651136342073, -# 'OpEx_val': 60.50000000000001, -# 'area_tight': 11.614464, -# 'coll_length': 20.49594468696311, -# 'mooring_spacing': 0.0582385263254008, -# 'turbine_spacing': 0.8519999999999998} - - -## 20250714 -# RESULTS: - -# {'AEP_val': 4818.0, -# 'BOS_val': 1431.448205129097, -# 'CapEx_val': 768.4437570425, -# 'LCOE_val': 46.80197118365915, -# 'OpEx_val': 60.50000000000001, -# 'area_tight': 63.234304, -# 'coll_length': 47.712041428901635} - -# RESULTS (opt): - -# {'AEP_val': 4818.0, -# 'BOS_val': 1412.8143111685533, -# 'CapEx_val': 768.4437570425, -# 'LCOE_val': 46.51190434118493, -# 'OpEx_val': 60.50000000000001, -# 'area_tight': 11.614464, -# 'coll_length': 20.507898644867613, -# 'turbine_spacing': 0.8519999999999999} diff --git a/examples/04_offshore_floating/inputs/ard_system.yaml b/examples/03_offshore_floating/inputs/ard_system.yaml similarity index 97% rename from examples/04_offshore_floating/inputs/ard_system.yaml rename to examples/03_offshore_floating/inputs/ard_system.yaml index c34f5514..b61d5dde 100644 --- a/examples/04_offshore_floating/inputs/ard_system.yaml +++ b/examples/03_offshore_floating/inputs/ard_system.yaml @@ -24,7 +24,11 @@ modeling_options: &modeling_options solver_name: "highs" solver_options: time_limit: 60 - mip_gap: 0.005 + mip_gap: 0.02 + model_options: + topology: "branched" + feeder_route: "segmented" + feeder_limit: "unlimited" offshore: true floating: true diff --git a/examples/04_offshore_floating/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv b/examples/03_offshore_floating/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv similarity index 100% rename from examples/04_offshore_floating/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv rename to examples/03_offshore_floating/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv diff --git a/examples/04_offshore_floating/inputs/turbine_spec_IEA-22-284-RWT.yaml b/examples/03_offshore_floating/inputs/turbine_spec_IEA-22-284-RWT.yaml similarity index 100% rename from examples/04_offshore_floating/inputs/turbine_spec_IEA-22-284-RWT.yaml rename to examples/03_offshore_floating/inputs/turbine_spec_IEA-22-284-RWT.yaml diff --git a/examples/04_offshore_floating/inputs/wrg_example.wrg b/examples/03_offshore_floating/inputs/wrg_example.wrg similarity index 100% rename from examples/04_offshore_floating/inputs/wrg_example.wrg rename to examples/03_offshore_floating/inputs/wrg_example.wrg diff --git a/examples/04_offshore_floating/optimization_demo.py b/examples/03_offshore_floating/optimization_demo.py similarity index 98% rename from examples/04_offshore_floating/optimization_demo.py rename to examples/03_offshore_floating/optimization_demo.py index ff9026fc..39daf62b 100644 --- a/examples/04_offshore_floating/optimization_demo.py +++ b/examples/03_offshore_floating/optimization_demo.py @@ -24,8 +24,9 @@ def run_example(): # run the model prob.run_model() - # visualize model - # om.n2(prob, "new") + if False: + # visualize model + om.n2(prob) # collapse the test result data test_data = { diff --git a/pyproject.toml b/pyproject.toml index 84861cb4..a09bcdb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,12 +13,16 @@ build-backend = "setuptools.build_meta" where = ["."] include = ["ard", "ard.*"] +[tool.setuptools.package-data] +"ard.api.default_systems" = ["*.yaml"] + [project] name = "Ard" version = "1.0.0-alpha0" authors = [ {name = "Cory Frontin", email = "cory.frontin@nrel.gov"}, {name = "Rafael Mudafort", email = "rafael.mudafort@nrel.gov"}, + {name = "Jared Thomas", email = "jared.thomas@nrel.gov"}, ] description = "A package for multidisciplinary and/or multifidelity wind farm design" readme= "README.md" @@ -43,7 +47,7 @@ dependencies = [ "shapely", "jax", "optiwindnet>=0.0.4", - "statsmodels@git+https://github.com/statsmodels/statsmodels.git@main", + "statsmodels", "highspy", "pyyaml", ]